YulOpt: Remove empty cases

This commit is contained in:
Mathias Baumann
2019-03-06 19:02:23 +01:00
committed by chriseth
parent be52aa3181
commit 21322dae29
6 changed files with 32 additions and 6 deletions
+4
View File
@@ -28,6 +28,9 @@ namespace yul
* - replace if with empty body with pop(condition)
* - replace if with true condition with its body
* - remove if with false condition
* - remove empty default switch case
* - remove empty switch case if no default case exists
* - replace switch with no cases with pop(expression)
* - turn switch with single case into if
* - replace switch with only default case with pop(expression) and body
* - replace switch with const expr with matching case body
@@ -49,6 +52,7 @@ private:
bool expressionAlwaysTrue(Expression const& _expression);
bool expressionAlwaysFalse(Expression const& _expression);
boost::optional<dev::u256> hasLiteralValue(Expression const& _expression) const;
boost::optional<std::vector<Statement>> reduceNoCaseSwitch(Switch& _switchStmt) const;
};
}