aboutsummaryrefslogtreecommitdiffstats
path: root/Assembly.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-05-12 22:16:44 +0800
committerchriseth <c@ethdev.com>2015-05-12 22:27:43 +0800
commitced4720faa63eb7a1842eb1dbc17522a1ec458fd (patch)
tree5701cb7b4353d50f878a17879e3bc148ed00e454 /Assembly.cpp
parent60d69c78f5d165341ce76f63a7e95418c95a3481 (diff)
downloaddexon-solidity-ced4720faa63eb7a1842eb1dbc17522a1ec458fd.tar
dexon-solidity-ced4720faa63eb7a1842eb1dbc17522a1ec458fd.tar.gz
dexon-solidity-ced4720faa63eb7a1842eb1dbc17522a1ec458fd.tar.bz2
dexon-solidity-ced4720faa63eb7a1842eb1dbc17522a1ec458fd.tar.lz
dexon-solidity-ced4720faa63eb7a1842eb1dbc17522a1ec458fd.tar.xz
dexon-solidity-ced4720faa63eb7a1842eb1dbc17522a1ec458fd.tar.zst
dexon-solidity-ced4720faa63eb7a1842eb1dbc17522a1ec458fd.zip
Unify blocks with shared code.
Diffstat (limited to 'Assembly.cpp')
-rw-r--r--Assembly.cpp10
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++;
}
}