From c224b09bb35c67fe2abadfb2f0f40b6fd2078e84 Mon Sep 17 00:00:00 2001 From: chriseth Date: Fri, 13 Sep 2019 18:09:16 +0200 Subject: [PATCH] Fix reordering bug in optimizer. --- Changelog.md | 1 + libevmasm/RuleList.h | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index 976ee721a..519e11559 100644 --- a/Changelog.md +++ b/Changelog.md @@ -14,6 +14,7 @@ Compiler Features: Bugfixes: * Fix internal error when popping a dynamic storage array of mappings. + * Yul Optimizer: Fix reordering bug in connection with shifted one and mul/div-instructions in for loop conditions. ### 0.5.11 (2019-08-12) diff --git a/libevmasm/RuleList.h b/libevmasm/RuleList.h index f2422ce58..58e773f30 100644 --- a/libevmasm/RuleList.h +++ b/libevmasm/RuleList.h @@ -475,7 +475,8 @@ std::vector> simplificationRuleListPart7( [=]() -> Pattern { return {Instruction::SHL, {Y, X}}; }, - false + // Actually only changes the order, does not remove. + true }); rules.push_back({ // MUL(SHL(X, 1), Y) -> SHL(X, Y) @@ -492,7 +493,8 @@ std::vector> simplificationRuleListPart7( [=]() -> Pattern { return {Instruction::SHR, {Y, X}}; }, - false + // Actually only changes the order, does not remove. + true }); std::function feasibilityFunction = [=]() {