Skip to content

Commit eb8f830

Browse files
committed
Remove unnecessary masking of the result of known short instructions
1 parent f925747 commit eb8f830

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
### 0.4.23 (unreleased)
22

33
Features:
4+
* Optimizer: Remove unnecessary masking of the result of known short instructions (``ADDRESS``, ``CALLER``, ``ORIGIN`` and ``COINBASE``).
45
* SMTChecker: Integration with CVC4 SMT solver
56

67
Bugfixes:

libevmasm/RuleList.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,18 @@ std::vector<SimplificationRule<Pattern>> simplificationRuleList(
174174
});
175175
}
176176

177+
for (auto const& op: std::vector<Instruction>{
178+
Instruction::ADDRESS,
179+
Instruction::CALLER,
180+
Instruction::ORIGIN,
181+
Instruction::COINBASE
182+
})
183+
rules.push_back({
184+
{Instruction::AND, {{u256("0xffffffffffffffffffffffffffffffffffffffff"), op}}},
185+
[=]() -> Pattern { return op; },
186+
false
187+
});
188+
177189
// Double negation of opcodes with boolean result
178190
for (auto const& op: std::vector<Instruction>{
179191
Instruction::EQ,

0 commit comments

Comments
 (0)