Skip to content

Commit 4b13837

Browse files
committed
No need for mutable, Remove flaky tests
1 parent efc0060 commit 4b13837

File tree

3 files changed

+2
-128
lines changed

3 files changed

+2
-128
lines changed

libyul/optimiser/VarNameCleaner.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,7 @@ YulName VarNameCleaner::findCleanName(YulName const& _name) const
104104

105105
// Use a per-base-name counter to avoid O(n²) probing when many
106106
// variables share the same stripped base name.
107-
size_t& nextSuffix = m_nextSuffix.at(newName);
108-
if (nextSuffix == 0)
109-
nextSuffix = 1;
107+
size_t nextSuffix = util::valueOrDefault(m_nextSuffix, newName, static_cast<size_t>(1));
110108
for (; nextSuffix < std::numeric_limits<size_t>::max(); ++nextSuffix)
111109
{
112110
YulName newNameSuffixed = YulName{newName.str() + "_" + std::to_string(nextSuffix)};

libyul/optimiser/VarNameCleaner.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class VarNameCleaner: public ASTModifier
9090
std::set<YulName> m_usedNames;
9191

9292
/// Next suffix to try per stripped base name, avoids O(n²) probing.
93-
mutable std::map<YulName, size_t> m_nextSuffix;
93+
std::map<YulName, size_t> m_nextSuffix;
9494

9595
/// Maps old to new names.
9696
std::map<YulName, YulName> m_translatedNames;

test/libyul/VarNameCleanerPerf.cpp

Lines changed: 0 additions & 124 deletions
This file was deleted.

0 commit comments

Comments
 (0)