diff options
Diffstat (limited to 'libyul/optimiser/DataFlowAnalyzer.cpp')
-rw-r--r-- | libyul/optimiser/DataFlowAnalyzer.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libyul/optimiser/DataFlowAnalyzer.cpp b/libyul/optimiser/DataFlowAnalyzer.cpp index 64c67b38..7bff2c89 100644 --- a/libyul/optimiser/DataFlowAnalyzer.cpp +++ b/libyul/optimiser/DataFlowAnalyzer.cpp @@ -136,17 +136,22 @@ void DataFlowAnalyzer::operator()(Block& _block) void DataFlowAnalyzer::handleAssignment(set<YulString> const& _variables, Expression* _value) { + static Expression const zero{Literal{{}, LiteralKind::Number, YulString{"0"}, {}}}; clearValues(_variables); MovableChecker movableChecker; if (_value) movableChecker.visit(*_value); - if (_variables.size() == 1) + else + for (auto const& var: _variables) + m_value[var] = &zero; + + if (_value && _variables.size() == 1) { YulString name = *_variables.begin(); // Expression has to be movable and cannot contain a reference // to the variable that will be assigned to. - if (_value && movableChecker.movable() && !movableChecker.referencedVariables().count(name)) + if (movableChecker.movable() && !movableChecker.referencedVariables().count(name)) m_value[name] = _value; } |