@@ -167,22 +167,22 @@ class IntroduceControlFlowSSA: public ASTModifier
167167 // / Variables (that are to be replaced) currently in scope.
168168 std::set<YulString> m_variablesInScope;
169169 // / Variables that do not have a specific value.
170- std::vector <YulString> m_variablesToReassign;
170+ util::UniqueVector <YulString> m_variablesToReassign;
171171 TypeInfo const & m_typeInfo;
172172};
173173
174174void IntroduceControlFlowSSA::operator ()(FunctionDefinition& _function)
175175{
176176 std::set<YulString> varsInScope;
177177 std::swap (varsInScope, m_variablesInScope);
178- std::vector <YulString> toReassign;
178+ util::UniqueVector <YulString> toReassign;
179179 std::swap (toReassign, m_variablesToReassign);
180180
181181 for (auto const & param: _function.parameters )
182182 if (m_variablesToReplace.count (param.name ))
183183 {
184184 m_variablesInScope.insert (param.name );
185- m_variablesToReassign.push_back (param.name );
185+ m_variablesToReassign.pushBack (param.name );
186186 }
187187
188188 ASTModifier::operator ()(_function);
@@ -196,8 +196,8 @@ void IntroduceControlFlowSSA::operator()(ForLoop& _for)
196196 yulAssert (_for.pre .statements .empty (), " For loop init rewriter not run." );
197197
198198 for (auto const & var: assignedVariableNames (_for.body ) + assignedVariableNames (_for.post ))
199- if (util::contains (m_variablesInScope,var) && ! util::contains (m_variablesToReassign, var) )
200- m_variablesToReassign.push_back (var);
199+ if (util::contains (m_variablesInScope,var))
200+ m_variablesToReassign.pushBack (var);
201201
202202 (*this )(_for.body );
203203 (*this )(_for.post );
@@ -207,20 +207,20 @@ void IntroduceControlFlowSSA::operator()(Switch& _switch)
207207{
208208 yulAssert (m_variablesToReassign.empty (), " " );
209209
210- std::vector <YulString> toReassign;
210+ util::UniqueVector <YulString> toReassign;
211211 for (auto & c: _switch.cases )
212212 {
213213 (*this )(c.body );
214- util::appendMissing ( toReassign, m_variablesToReassign);
214+ toReassign. pushBack ( m_variablesToReassign);
215215 }
216216
217- util::appendMissing ( m_variablesToReassign, toReassign);
217+ m_variablesToReassign. pushBack ( toReassign);
218218}
219219
220220void IntroduceControlFlowSSA::operator ()(Block& _block)
221221{
222- std::vector <YulString> variablesDeclaredHere;
223- std::vector <YulString> assignedVariables;
222+ util::UniqueVector <YulString> variablesDeclaredHere;
223+ util::UniqueVector <YulString> assignedVariables;
224224
225225 util::iterateReplacing (
226226 _block.statements ,
@@ -235,8 +235,7 @@ void IntroduceControlFlowSSA::operator()(Block& _block)
235235 {TypedName{debugDataOf (_s), newName, m_typeInfo.typeOfVariable (toReassign)}},
236236 std::make_unique<Expression>(Identifier{debugDataOf (_s), toReassign})
237237 });
238- if (!util::contains (assignedVariables, toReassign))
239- assignedVariables.push_back (toReassign);
238+ assignedVariables.pushBack (toReassign);
240239 }
241240 m_variablesToReassign.clear ();
242241
@@ -246,16 +245,16 @@ void IntroduceControlFlowSSA::operator()(Block& _block)
246245 for (auto const & var: varDecl.variables )
247246 if (m_variablesToReplace.count (var.name ))
248247 {
249- util::tryEmplaceBack ( variablesDeclaredHere, var.name );
248+ variablesDeclaredHere. pushBack ( var.name );
250249 m_variablesInScope.insert (var.name );
251250 }
252251 }
253252 else if (std::holds_alternative<Assignment>(_s))
254253 {
255254 Assignment& assignment = std::get<Assignment>(_s);
256255 for (auto const & var: assignment.variableNames )
257- if (m_variablesToReplace.count (var.name ) && ! util::contains (assignedVariables, var. name ) )
258- assignedVariables.push_back (var.name );
256+ if (m_variablesToReplace.count (var.name ))
257+ assignedVariables.pushBack (var.name );
259258 }
260259 else
261260 visit (_s);
@@ -270,9 +269,9 @@ void IntroduceControlFlowSSA::operator()(Block& _block)
270269 }
271270 );
272271
273- util::appendMissing ( m_variablesToReassign, assignedVariables);
274- m_variablesInScope -= variablesDeclaredHere;
275- m_variablesToReassign -= variablesDeclaredHere;
272+ m_variablesToReassign. pushBack ( assignedVariables);
273+ m_variablesInScope -= variablesDeclaredHere. contents () ;
274+ m_variablesToReassign. removeAll ( variablesDeclaredHere. contents ()) ;
276275}
277276
278277/* *
0 commit comments