Remove unnecessary masking of the result of known short instructions

This commit is contained in:
Alex Beregszaszi
2018-04-19 23:59:06 +01:00
parent 27d7990684
commit 38460d8b47
4 changed files with 110 additions and 0 deletions
+20
View File
@@ -174,6 +174,26 @@ std::vector<SimplificationRule<Pattern>> simplificationRuleList(
});
}
for (auto const& op: std::vector<Instruction>{
Instruction::ADDRESS,
Instruction::CALLER,
Instruction::ORIGIN,
Instruction::COINBASE
})
{
u256 const mask = (u256(1) << 160) - 1;
rules.push_back({
{Instruction::AND, {{op, mask}}},
[=]() -> Pattern { return op; },
false
});
rules.push_back({
{Instruction::AND, {{mask, op}}},
[=]() -> Pattern { return op; },
false
});
}
// Double negation of opcodes with boolean result
for (auto const& op: std::vector<Instruction>{
Instruction::EQ,