aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2016-10-24 16:58:25 +0800
committerGitHub <noreply@github.com>2016-10-24 16:58:25 +0800
commit84b43b91396a3d60da055d2957501f4690fcb5cc (patch)
tree236d197514bcee01a2f072c25910b08b8594c66e
parent3e13e59ff96d92f18b972f10f4ef1da1ef249b32 (diff)
parentba42c6e447549e7313a1df88b6ac5a55a79ef263 (diff)
downloaddexon-solidity-84b43b91396a3d60da055d2957501f4690fcb5cc.tar.gz
dexon-solidity-84b43b91396a3d60da055d2957501f4690fcb5cc.tar.zst
dexon-solidity-84b43b91396a3d60da055d2957501f4690fcb5cc.zip
Merge pull request #1267 from ethereum/optimizer
Optimizer: generate code starting with empty state
-rw-r--r--Changelog.md1
-rw-r--r--libevmasm/Assembly.cpp6
2 files changed, 5 insertions, 2 deletions
diff --git a/Changelog.md b/Changelog.md
index 22db4f95..911967e4 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -9,6 +9,7 @@ Features:
* Support shifting constant numbers.
Bugfixes:
+ * Optimizer: fix related to stale knowledge about SHA3 operations
* Disallow unknown options in ``solc``.
* Proper type checking for bound functions.
* Code Generator: expect zero stack increase after `super` as an expression.
diff --git a/libevmasm/Assembly.cpp b/libevmasm/Assembly.cpp
index 450ee6ce..e881c1e2 100644
--- a/libevmasm/Assembly.cpp
+++ b/libevmasm/Assembly.cpp
@@ -327,8 +327,10 @@ Assembly& Assembly::optimise(bool _enable, bool _isCreation, size_t _runs)
AssemblyItems optimisedItems;
for (BasicBlock const& block: cfg.optimisedBlocks())
{
- assertThrow(!!block.startState, OptimizerException, "");
- CommonSubexpressionEliminator eliminator(*block.startState);
+ // We used to start with the block's initial state but it caused
+ // too many inconsistencies.
+ KnownState emptyState;
+ CommonSubexpressionEliminator eliminator(emptyState);
auto iter = m_items.begin() + block.begin;
auto const end = m_items.begin() + block.end;
while (iter < end)