Skip to content

Commit

Permalink
Optimizer: generate code starting with empty state
Browse files Browse the repository at this point in the history
  • Loading branch information
chriseth committed Oct 21, 2016
1 parent 3e13e59 commit ba42c6e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 4 additions & 2 deletions libevmasm/Assembly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ba42c6e

Please sign in to comment.