Add more optimisation rules for shifts

This commit is contained in:
Alex Beregszaszi 2019-02-15 14:12:04 +00:00
parent c5577145d3
commit fd936439a4
2 changed files with 5 additions and 0 deletions

View File

@ -6,6 +6,7 @@ Language Features:
Compiler Features:
* SMTChecker: Do not report underflow/overflow if they always revert. This removes false positives when using ``SafeMath``.
* Static Analyzer: Warn about expressions with custom types when they have no effect.
* Optimizer: Add rule for shifts with constants for Constantinople.
Bugfixes:

View File

@ -140,6 +140,10 @@ std::vector<SimplificationRule<Pattern>> simplificationRuleListPart2(
{{Instruction::MOD, {0, X}}, [=]{ return u256(0); }, true},
{{Instruction::EQ, {X, 0}}, [=]() -> Pattern { return {Instruction::ISZERO, {X}}; }, false },
{{Instruction::EQ, {0, X}}, [=]() -> Pattern { return {Instruction::ISZERO, {X}}; }, false },
{{Instruction::SHL, {0, X}}, [=]{ return X; }, false},
{{Instruction::SHR, {0, X}}, [=]{ return X; }, false},
{{Instruction::SHL, {X, 0}}, [=]{ return u256(0); }, true},
{{Instruction::SHR, {X, 0}}, [=]{ return u256(0); }, true},
};
}