mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
More optimiser rules for LT/GT/AND/BYTE
This commit is contained in:
parent
68e1bf47d5
commit
7aa2ee1775
@ -10,6 +10,7 @@ Compiler Features:
|
|||||||
* Inline Assembly: Instructions unavailable to the currently configured EVM are errors now.
|
* Inline Assembly: Instructions unavailable to the currently configured EVM are errors now.
|
||||||
* SMTChecker: Do not report underflow/overflow if they always revert. This removes false positives when using ``SafeMath``.
|
* 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.
|
* Static Analyzer: Warn about expressions with custom types when they have no effect.
|
||||||
|
* Optimizer: Add new rules with constants including ``LT``, ``GT``, ``AND`` and ``BYTE``.
|
||||||
* Optimizer: Add rule for shifts with constants for Constantinople.
|
* Optimizer: Add rule for shifts with constants for Constantinople.
|
||||||
* Optimizer: Combine multiple shifts with constant shift-by values into one.
|
* Optimizer: Combine multiple shifts with constant shift-by values into one.
|
||||||
* Optimizer: Support shifts in the constant optimiser for Constantinople.
|
* Optimizer: Support shifts in the constant optimiser for Constantinople.
|
||||||
|
@ -108,7 +108,7 @@ std::vector<SimplificationRule<Pattern>> simplificationRuleListPart2(
|
|||||||
Pattern,
|
Pattern,
|
||||||
Pattern,
|
Pattern,
|
||||||
Pattern X,
|
Pattern X,
|
||||||
Pattern
|
Pattern Y
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return std::vector<SimplificationRule<Pattern>> {
|
return std::vector<SimplificationRule<Pattern>> {
|
||||||
@ -146,6 +146,12 @@ std::vector<SimplificationRule<Pattern>> simplificationRuleListPart2(
|
|||||||
{{Instruction::SHR, {0, X}}, [=]{ return X; }, false},
|
{{Instruction::SHR, {0, X}}, [=]{ return X; }, false},
|
||||||
{{Instruction::SHL, {X, 0}}, [=]{ return u256(0); }, true},
|
{{Instruction::SHL, {X, 0}}, [=]{ return u256(0); }, true},
|
||||||
{{Instruction::SHR, {X, 0}}, [=]{ return u256(0); }, true},
|
{{Instruction::SHR, {X, 0}}, [=]{ return u256(0); }, true},
|
||||||
|
{{Instruction::LT, {X, 0}}, [=]{ return u256(0); }, true},
|
||||||
|
{{Instruction::GT, {X, 0}}, [=]() -> Pattern { return {Instruction::ISZERO, {{Instruction::ISZERO, {X}}}}; }, false},
|
||||||
|
{{Instruction::GT, {X, ~u256(0)}}, [=]{ return u256(0); }, true},
|
||||||
|
{{Instruction::GT, {0, X}}, [=]{ return u256(0); }, true},
|
||||||
|
{{Instruction::AND, {{Instruction::BYTE, {X, Y}}, {u256(0xff)}}}, [=]() -> Pattern { return {Instruction::BYTE, {X, Y}}; }, false},
|
||||||
|
{{Instruction::BYTE, {X, 31}}, [=]() -> Pattern { return {Instruction::AND, {X, u256(0xff)}}; }, false}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user