diff options
author | chriseth <c@ethdev.com> | 2015-06-06 18:42:36 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-06-06 18:42:36 +0800 |
commit | 7bdd1b1d4ae46920ae54aaa61c40b411a75f15b9 (patch) | |
tree | 8a971a7cf482e30a7bc37b8f0ef5ee6be78852c9 /ExpressionClasses.cpp | |
parent | cad767de61dc53b9b297f08ee09cb5a3c0821782 (diff) | |
download | dexon-solidity-7bdd1b1d4ae46920ae54aaa61c40b411a75f15b9.tar.gz dexon-solidity-7bdd1b1d4ae46920ae54aaa61c40b411a75f15b9.tar.zst dexon-solidity-7bdd1b1d4ae46920ae54aaa61c40b411a75f15b9.zip |
Optimize double ISZERO.
Diffstat (limited to 'ExpressionClasses.cpp')
-rw-r--r-- | ExpressionClasses.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ExpressionClasses.cpp b/ExpressionClasses.cpp index 81ba1154..5ad8e724 100644 --- a/ExpressionClasses.cpp +++ b/ExpressionClasses.cpp @@ -260,6 +260,22 @@ Rules::Rules() {{Instruction::NOT, {{Instruction::NOT, {X}}}}, [=]{ return X; }}, }; + // Double negation of opcodes with binary result + for (auto const& op: vector<Instruction>{ + Instruction::EQ, + Instruction::LT, + Instruction::SLT, + Instruction::GT, + Instruction::SGT + }) + m_rules.push_back({ + {Instruction::ISZERO, {{Instruction::ISZERO, {{op, {X, Y}}}}}}, + [=]() -> Pattern { return {op, {X, Y}}; } + }); + m_rules.push_back({ + {Instruction::ISZERO, {{Instruction::ISZERO, {{Instruction::ISZERO, {X}}}}}}, + [=]() -> Pattern { return {Instruction::ISZERO, {X}}; } + }); // Associative operations for (auto const& opFun: vector<pair<Instruction,function<u256(u256 const&,u256 const&)>>>{ {Instruction::ADD, plus<u256>()}, |