diff options
author | chriseth <chris@ethereum.org> | 2018-01-18 20:58:51 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-02-07 05:51:30 +0800 |
commit | 65c31ecaeb66e186a0ab6aa6cb2c44ec1a35a868 (patch) | |
tree | 797e4745e14d5952a39c6b5c907cc4d61df7b9d5 /libevmasm | |
parent | 295f8c07ad63cd1b0c5176bd39e9c13f64968c7e (diff) | |
download | dexon-solidity-65c31ecaeb66e186a0ab6aa6cb2c44ec1a35a868.tar dexon-solidity-65c31ecaeb66e186a0ab6aa6cb2c44ec1a35a868.tar.gz dexon-solidity-65c31ecaeb66e186a0ab6aa6cb2c44ec1a35a868.tar.bz2 dexon-solidity-65c31ecaeb66e186a0ab6aa6cb2c44ec1a35a868.tar.lz dexon-solidity-65c31ecaeb66e186a0ab6aa6cb2c44ec1a35a868.tar.xz dexon-solidity-65c31ecaeb66e186a0ab6aa6cb2c44ec1a35a868.tar.zst dexon-solidity-65c31ecaeb66e186a0ab6aa6cb2c44ec1a35a868.zip |
Remove recursive call to simplify with reversed arguments.
(We now have explicit rules for that).
Diffstat (limited to 'libevmasm')
-rw-r--r-- | libevmasm/ExpressionClasses.cpp | 9 | ||||
-rw-r--r-- | libevmasm/ExpressionClasses.h | 3 |
2 files changed, 2 insertions, 10 deletions
diff --git a/libevmasm/ExpressionClasses.cpp b/libevmasm/ExpressionClasses.cpp index 58c254b1..3825f5ed 100644 --- a/libevmasm/ExpressionClasses.cpp +++ b/libevmasm/ExpressionClasses.cpp @@ -181,7 +181,7 @@ string ExpressionClasses::fullDAGToString(ExpressionClasses::Id _id) const return str.str(); } -ExpressionClasses::Id ExpressionClasses::tryToSimplify(Expression const& _expr, bool _secondRun) +ExpressionClasses::Id ExpressionClasses::tryToSimplify(Expression const& _expr) { static Rules rules; @@ -205,13 +205,6 @@ ExpressionClasses::Id ExpressionClasses::tryToSimplify(Expression const& _expr, return rebuildExpression(ExpressionTemplate(std::get<1>(*match)(), _expr.item->location())); } - if (!_secondRun && _expr.arguments.size() == 2 && SemanticInformation::isCommutativeOperation(*_expr.item)) - { - Expression expr = _expr; - swap(expr.arguments[0], expr.arguments[1]); - return tryToSimplify(expr, true); - } - return -1; } diff --git a/libevmasm/ExpressionClasses.h b/libevmasm/ExpressionClasses.h index 6b426e97..df8082f9 100644 --- a/libevmasm/ExpressionClasses.h +++ b/libevmasm/ExpressionClasses.h @@ -108,8 +108,7 @@ public: private: /// Tries to simplify the given expression. /// @returns its class if it possible or Id(-1) otherwise. - /// @param _secondRun is set to true for the second run where arguments of commutative expressions are reversed - Id tryToSimplify(Expression const& _expr, bool _secondRun = false); + Id tryToSimplify(Expression const& _expr); /// Rebuilds an expression from a (matched) pattern. Id rebuildExpression(ExpressionTemplate const& _template); |