mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add optimization rule SUB(~0, X) -> NOT(X).
This commit is contained in:
parent
4aa0c9e079
commit
7f322c9433
@ -5,6 +5,7 @@ Language Features:
|
||||
|
||||
|
||||
Compiler Features:
|
||||
* Optimizer: Add rule to simplify SUB(~0, X) to NOT(X).
|
||||
|
||||
|
||||
|
||||
|
@ -124,6 +124,7 @@ std::vector<SimplificationRule<Pattern>> simplificationRuleListPart2(
|
||||
{{Instruction::ADD, {X, 0}}, [=]{ return X; }, false},
|
||||
{{Instruction::ADD, {0, X}}, [=]{ return X; }, false},
|
||||
{{Instruction::SUB, {X, 0}}, [=]{ return X; }, false},
|
||||
{{Instruction::SUB, {~u256(0), X}}, [=]() -> Pattern { return {Instruction::NOT, {X}}; }, false},
|
||||
{{Instruction::MUL, {X, 0}}, [=]{ return u256(0); }, true},
|
||||
{{Instruction::MUL, {0, X}}, [=]{ return u256(0); }, true},
|
||||
{{Instruction::MUL, {X, 1}}, [=]{ return X; }, false},
|
||||
|
Loading…
Reference in New Issue
Block a user