diff options
author | Yoichi Hirai <i@yoichihirai.com> | 2016-11-25 01:21:57 +0800 |
---|---|---|
committer | Yoichi Hirai <i@yoichihirai.com> | 2016-11-25 01:22:22 +0800 |
commit | b6ffb6c8b7a581e1c3d0e7882be0d1606cc37509 (patch) | |
tree | 270a32222cd97102372959a226a470191922824d | |
parent | c0fe5fbe9b474a9cd0db10db5e4410e7950d9a93 (diff) | |
download | dexon-solidity-b6ffb6c8b7a581e1c3d0e7882be0d1606cc37509.tar dexon-solidity-b6ffb6c8b7a581e1c3d0e7882be0d1606cc37509.tar.gz dexon-solidity-b6ffb6c8b7a581e1c3d0e7882be0d1606cc37509.tar.bz2 dexon-solidity-b6ffb6c8b7a581e1c3d0e7882be0d1606cc37509.tar.lz dexon-solidity-b6ffb6c8b7a581e1c3d0e7882be0d1606cc37509.tar.xz dexon-solidity-b6ffb6c8b7a581e1c3d0e7882be0d1606cc37509.tar.zst dexon-solidity-b6ffb6c8b7a581e1c3d0e7882be0d1606cc37509.zip |
libevmasm: generalize ADDPOP optimization into ADDMODPOP etc
-rw-r--r-- | libevmasm/PeepholeOptimiser.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libevmasm/PeepholeOptimiser.cpp b/libevmasm/PeepholeOptimiser.cpp index 104d9769..901e310e 100644 --- a/libevmasm/PeepholeOptimiser.cpp +++ b/libevmasm/PeepholeOptimiser.cpp @@ -68,14 +68,15 @@ struct AddPop { Instruction i0 = _in[0].instruction(); if (instructionInfo(i0).ret == 1 && - instructionInfo(i0).args == 2 && !SemanticInformation::invalidatesMemory(i0) && - !SemanticInformation::invalidatesStorage(i0) + !SemanticInformation::invalidatesStorage(i0) && + !SemanticInformation::altersControlFlow(i0) && + !instructionInfo(i0).sideEffects ) { - *_out = Instruction::POP; - *_out = Instruction::POP; - return true; + for (int j = 0; j < instructionInfo(i0).args; j++) + *_out = Instruction::POP; + return true; } } return false; |