diff --git a/libevmasm/CommonSubexpressionEliminator.cpp b/libevmasm/CommonSubexpressionEliminator.cpp index 8a4e9f6e3..397d20f16 100644 --- a/libevmasm/CommonSubexpressionEliminator.cpp +++ b/libevmasm/CommonSubexpressionEliminator.cpp @@ -219,7 +219,7 @@ void CSECodeGenerator::addDependencies(Id _c) { if (m_classPositions.count(_c)) return; // it is already on the stack - if (m_neededBy.count(_c)) + if (m_neededBy.find(_c) != m_neededBy.end()) return; // we already computed the dependencies for _c ExpressionClasses::Expression expr = m_expressionClasses.representative(_c); assertThrow(expr.item, OptimizerException, ""); @@ -300,8 +300,8 @@ void CSECodeGenerator::addDependencies(Id _c) void CSECodeGenerator::generateClassElement(Id _c, bool _allowSequenced) { - for (auto it: m_classPositions) - for (auto p: it.second) + for (auto const& it: m_classPositions) + for (int p: it.second) if (p > m_stackHeight) { assertThrow(false, OptimizerException, ""); diff --git a/libevmasm/CommonSubexpressionEliminator.h b/libevmasm/CommonSubexpressionEliminator.h index 88e559719..51a5d74b2 100644 --- a/libevmasm/CommonSubexpressionEliminator.h +++ b/libevmasm/CommonSubexpressionEliminator.h @@ -24,11 +24,12 @@ #pragma once -#include #include +#include #include #include -#include +#include +#include #include #include #include @@ -154,11 +155,11 @@ private: /// Current height of the stack relative to the start. int m_stackHeight = 0; /// If (b, a) is in m_requests then b is needed to compute a. - std::multimap m_neededBy; + std::unordered_multimap m_neededBy; /// Current content of the stack. std::map m_stack; /// Current positions of equivalence classes, equal to the empty set if already deleted. - std::map> m_classPositions; + std::unordered_map> m_classPositions; /// The actual equivalence class items and how to compute them. ExpressionClasses& m_expressionClasses;