crytic / rattle

evm binary static analysis
https://www.trailofbits.com/presentations/rattle/
344 stars 41 forks source link

Optimize PHI nodes #3

Closed withzombies closed 6 years ago

withzombies commented 6 years ago

We don't optimize PHI nodes.

A funny example:

python3 rattle.py --input inputs/0x1b0db6198bab2e573c62f209d32f99ad4c483dee.evm.bytecode

Outputs these blocks:

<SSA::Block offset:0x1ad>
   %126 = PHI(%89, %65)
   %129 = PHI(#61, #61)
   %72 = ISZERO(%126)
   JUMPI(#200, %72)

<SSA::Block offset:0x200>
   %128 = PHI(#61, %129, #61, #61, #61)
   JUMP(%128)

%128 should not be a PHI node at all, it should be #61.