vyperlang / vyper

Pythonic Smart Contract Language for the EVM
https://vyperlang.org
Other
4.85k stars 791 forks source link

feat[venom]: optimize branching #4049

Closed harkal closed 4 months ago

harkal commented 4 months ago

What I did

Added a pass to optimize inefficient branches

How I did it

How to verify it

Commit message

This commit introduces a new pass called `BranchOptimizationPass` 
that optimizes inefficient branches.

More specifically, when a branch is led with a logic inversion `ISZERO` 
we remove the `ISZERO` and invert the branch targets.

Description for the changelog

Cute Animal Picture

      /\_/\  
     ( o.o ) 
      > ^ <   "Please?"
codecov[bot] commented 4 months ago

Codecov Report

Attention: Patch coverage is 94.73684% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 88.63%. Comparing base (96a8384) to head (1f7a792).

:exclamation: Current head 1f7a792 differs from pull request most recent head c329834

Please upload reports for the commit c329834 to get more accurate results.

Files Patch % Lines
vyper/venom/passes/branch_optimization.py 94.11% 0 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #4049 +/- ## ========================================== - Coverage 91.01% 88.63% -2.39% ========================================== Files 106 107 +1 Lines 15387 15326 -61 Branches 3384 3369 -15 ========================================== - Hits 14005 13584 -421 - Misses 948 1231 +283 - Partials 434 511 +77 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.