diff options
Diffstat (limited to 'Assembly.cpp')
-rw-r--r-- | Assembly.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Assembly.cpp b/Assembly.cpp index abcd4451..1011392b 100644 --- a/Assembly.cpp +++ b/Assembly.cpp @@ -24,6 +24,7 @@ #include <libdevcore/Log.h> #include <libevmasm/CommonSubexpressionEliminator.h> #include <libevmasm/ControlFlowGraph.h> +#include <libevmasm/BlockDeduplicator.h> #include <json/json.h> using namespace std; using namespace dev; @@ -348,8 +349,17 @@ Assembly& Assembly::optimise(bool _enable) copy(orig, iter, back_inserter(optimisedItems)); } } + if (optimisedItems.size() < m_items.size()) + { m_items = move(optimisedItems); + count++; + } + + // This only modifies PushTags, we have to run again to actually remove code. + BlockDeduplicator dedup(m_items); + if (dedup.deduplicate()) + count++; } } |