Skip to content

perf(compiler): add EVM peepholes and branch shaping - #435

Merged
zoowii merged 9 commits into
DTVMStack:mainfrom
abmcar:perf/evm-peephole-rules
Apr 13, 2026
Merged

perf(compiler): add EVM peepholes and branch shaping#435
zoowii merged 9 commits into
DTVMStack:mainfrom
abmcar:perf/evm-peephole-rules

Conversation

@abmcar

@abmcar abmcar commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add EVM frontend peepholes for zero/one/all-ones identities in ADD, SUB, MUL, AND, OR, and XOR
  • defer NOT and zero-test materialization so ISZERO chains can collapse without building redundant 256-bit MIR values
  • improve x86 lowering and CG peepholes for compare chains and short-diamond branches to reduce extra branch and movzx/test sequences

Implementation

  • src/compiler/evm_frontend/evm_mir_compiler.h
    • add constant helpers on Operand
    • add deferred operand kinds for bitwise-not and zero-test
    • early-return identity paths in binary and bitwise handlers
  • src/compiler/evm_frontend/evm_mir_compiler.cpp
    • add MUL zero/one fast paths
    • teach handleCompareEQZ() to emit either eq or ne for deferred zero tests
    • materialize deferred values only when a concrete U256Inst is actually needed
  • src/compiler/target/x86/x86_cg_peephole.cpp
    • fold cmp/test -> setcc -> [movzx] -> test -> jne into a shorter compare/branch form
  • src/compiler/target/x86/x86lowering.cpp
    • shape short diamonds so the true block falls through and the branch goes directly to the rejoin block on the zero case

Validation

  • tools/format.sh check
  • ./build/evmStateTests
    • passed 1798/1798

Benchmark

Compared with the same-session fix2 baseline on evmone-bench external totals:

  • geomean improvement: about 11.4%
  • total time reduction: about 3.8%

Representative wins:

  • external/total/main/jump_around/empty: about 48% faster
  • external/total/main/memory_grow_mload/by32: improved
  • external/total/main/memory_grow_mstore/by16: improved

Known remaining hot spots:

  • JUMPDEST_n0
  • loop_with_many_jumpdests

Copilot AI review requested due to automatic review settings March 27, 2026 09:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a set of EVM frontend and x86 backend peephole optimizations aimed at reducing redundant MIR materialization (notably around ISZERO/NOT) and producing tighter x86 compare/branch sequences and short-diamond branch layouts.

Changes:

  • Add EVM MIR builder constant-identity folds (e.g., +0, *0/*1, &0, &~0, |0, ^0) and introduce deferred operand kinds for bitwise-NOT and zero-test to enable collapsing ISZERO chains.
  • Materialize deferred values only when needed by teaching extractU256Operand() / argument conversion paths to realize deferred operands and by extending handleCompareEQZ() with a negation mode.
  • Improve x86 output by (a) folding cmp/test -> setcc -> [movzx] -> test -> jne into a direct jcc, and (b) shaping “short diamond” branches to prefer fallthrough to the true block.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/compiler/target/x86/x86lowering.cpp Adds short-diamond detection and inverts branch emission to make the true block fall through when safe.
src/compiler/target/x86/x86_cg_peephole.cpp Extends compare-chain peephole to handle optional movzx and shortens compare+branch sequences.
src/compiler/evm_frontend/evm_mir_compiler.h Introduces deferred operand kinds and constant helper predicates; adds identity folds in arithmetic/bitwise handlers; updates handleCompareEQZ() signature.
src/compiler/evm_frontend/evm_mir_compiler.cpp Implements MUL identity folds, deferred NOT/ISZERO materialization, and realizes deferred operands in extraction and arg-lowering paths.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@abmcar
abmcar marked this pull request as draft March 27, 2026 09:43
@github-actions

github-actions Bot commented Mar 27, 2026

Copy link
Copy Markdown

⚡ Performance Regression Check Results

✅ Performance Check Passed (interpreter)

Performance Benchmark Results (threshold: 25%)

Benchmark Baseline (us) Current (us) Change Status
total/main/blake2b_huff/8415nulls 1.50 1.59 +6.3% PASS
total/main/blake2b_huff/empty 0.02 0.03 +4.9% PASS
total/main/blake2b_shifts/8415nulls 11.61 12.10 +4.2% PASS
total/main/sha1_divs/5311 5.15 5.16 +0.4% PASS
total/main/sha1_divs/empty 0.06 0.06 +0.4% PASS
total/main/sha1_shifts/5311 2.80 2.94 +5.0% PASS
total/main/sha1_shifts/empty 0.03 0.04 +4.3% PASS
total/main/snailtracer/benchmark 52.35 53.85 +2.9% PASS
total/main/structarray_alloc/nfts_rank 0.96 0.99 +3.2% PASS
total/main/swap_math/insufficient_liquidity 0.00 0.00 +4.0% PASS
total/main/swap_math/received 0.00 0.00 +3.2% PASS
total/main/swap_math/spent 0.00 0.00 +2.6% PASS
total/main/weierstrudel/1 0.29 0.28 -1.2% PASS
total/main/weierstrudel/15 3.17 3.16 -0.5% PASS
total/micro/JUMPDEST_n0/empty 1.47 1.34 -8.4% PASS
total/micro/jump_around/empty 0.09 0.09 -0.8% PASS
total/micro/loop_with_many_jumpdests/empty 22.54 20.52 -8.9% PASS
total/micro/memory_grow_mload/by1 0.09 0.10 +14.7% PASS
total/micro/memory_grow_mload/by16 0.09 0.11 +15.3% PASS
total/micro/memory_grow_mload/by32 0.11 0.11 +5.6% PASS
total/micro/memory_grow_mload/nogrow 0.09 0.09 +8.1% PASS
total/micro/memory_grow_mstore/by1 0.09 0.11 +13.2% PASS
total/micro/memory_grow_mstore/by16 0.10 0.11 +4.6% PASS
total/micro/memory_grow_mstore/by32 0.12 0.12 -2.9% PASS
total/micro/memory_grow_mstore/nogrow 0.09 0.10 +17.0% PASS
total/micro/signextend/one 0.25 0.26 +2.8% PASS
total/micro/signextend/zero 0.25 0.25 -2.2% PASS
total/synth/ADD/b0 1.98 2.00 +0.9% PASS
total/synth/ADD/b1 1.97 1.99 +1.1% PASS
total/synth/ADDRESS/a0 4.98 4.82 -3.2% PASS
total/synth/ADDRESS/a1 5.34 5.47 +2.3% PASS
total/synth/AND/b0 1.71 1.71 +0.1% PASS
total/synth/AND/b1 1.71 1.71 +0.1% PASS
total/synth/BYTE/b0 6.08 6.12 +0.7% PASS
total/synth/BYTE/b1 4.77 4.74 -0.7% PASS
total/synth/CALLDATASIZE/a0 3.10 3.34 +7.9% PASS
total/synth/CALLDATASIZE/a1 3.77 3.62 -3.8% PASS
total/synth/CALLER/a0 4.96 4.93 -0.7% PASS
total/synth/CALLER/a1 5.35 5.44 +1.7% PASS
total/synth/CALLVALUE/a0 3.26 3.76 +15.4% PASS
total/synth/CALLVALUE/a1 3.52 3.75 +6.6% PASS
total/synth/CODESIZE/a0 3.91 3.99 +2.1% PASS
total/synth/CODESIZE/a1 3.77 4.01 +6.4% PASS
total/synth/DUP1/d0 1.19 1.31 +9.4% PASS
total/synth/DUP1/d1 1.31 1.39 +6.5% PASS
total/synth/DUP10/d0 0.89 1.31 +46.4% PASS
total/synth/DUP10/d1 1.23 1.39 +12.8% PASS
total/synth/DUP11/d0 0.91 1.15 +26.8% PASS
total/synth/DUP11/d1 1.00 1.15 +15.3% PASS
total/synth/DUP12/d0 0.97 1.07 +10.7% PASS
total/synth/DUP12/d1 1.23 1.39 +12.9% PASS
total/synth/DUP13/d0 0.91 1.15 +26.4% PASS
total/synth/DUP13/d1 1.23 1.39 +12.9% PASS
total/synth/DUP14/d0 0.91 1.39 +52.8% PASS
total/synth/DUP14/d1 1.23 1.39 +12.9% PASS
total/synth/DUP15/d0 0.91 1.15 +26.9% PASS
total/synth/DUP15/d1 1.23 1.39 +12.9% PASS
total/synth/DUP16/d0 0.91 1.15 +27.0% PASS
total/synth/DUP16/d1 1.04 1.16 +11.8% PASS
total/synth/DUP2/d0 0.98 1.39 +41.3% PASS
total/synth/DUP2/d1 1.23 1.39 +13.0% PASS
total/synth/DUP3/d0 0.90 1.31 +45.1% PASS
total/synth/DUP3/d1 1.00 1.39 +39.4% PASS
total/synth/DUP4/d0 0.98 1.15 +16.8% PASS
total/synth/DUP4/d1 1.23 1.39 +12.9% PASS
total/synth/DUP5/d0 0.90 1.07 +18.8% PASS
total/synth/DUP5/d1 1.23 1.39 +12.9% PASS
total/synth/DUP6/d0 0.90 1.39 +54.0% PASS
total/synth/DUP6/d1 1.23 1.39 +12.9% PASS
total/synth/DUP7/d0 0.91 1.31 +44.4% PASS
total/synth/DUP7/d1 1.23 1.39 +12.9% PASS
total/synth/DUP8/d0 0.91 1.31 +44.4% PASS
total/synth/DUP8/d1 1.23 1.39 +13.0% PASS
total/synth/DUP9/d0 0.90 1.07 +18.3% PASS
total/synth/DUP9/d1 1.23 1.39 +13.0% PASS
total/synth/EQ/b0 2.76 2.76 +0.0% PASS
total/synth/EQ/b1 1.40 1.33 -4.6% PASS
total/synth/GAS/a0 3.91 3.83 -2.1% PASS
total/synth/GAS/a1 3.93 3.85 -1.9% PASS
total/synth/GT/b0 2.62 2.61 -0.1% PASS
total/synth/GT/b1 1.47 1.56 +5.6% PASS
total/synth/ISZERO/u0 1.15 1.15 -0.0% PASS
total/synth/JUMPDEST/n0 1.47 1.33 -9.6% PASS
total/synth/LT/b0 2.61 2.62 +0.3% PASS
total/synth/LT/b1 1.48 1.56 +5.5% PASS
total/synth/MSIZE/a0 4.25 4.26 +0.1% PASS
total/synth/MSIZE/a1 4.74 4.88 +2.9% PASS
total/synth/MUL/b0 5.33 5.32 -0.1% PASS
total/synth/MUL/b1 5.40 5.39 -0.1% PASS
total/synth/NOT/u0 1.69 1.83 +8.1% PASS
total/synth/OR/b0 1.64 1.65 +0.5% PASS
total/synth/OR/b1 1.71 1.71 -0.0% PASS
total/synth/PC/a0 3.42 3.58 +4.7% PASS
total/synth/PC/a1 3.66 3.61 -1.6% PASS
total/synth/PUSH1/p0 1.15 1.23 +7.2% PASS
total/synth/PUSH1/p1 1.31 1.39 +6.5% PASS
total/synth/PUSH10/p0 1.15 1.23 +6.8% PASS
total/synth/PUSH10/p1 1.34 1.40 +4.4% PASS
total/synth/PUSH11/p0 1.15 1.07 -6.8% PASS
total/synth/PUSH11/p1 1.31 1.42 +8.6% PASS
total/synth/PUSH12/p0 0.99 1.15 +16.6% PASS
total/synth/PUSH12/p1 1.34 1.40 +4.7% PASS
total/synth/PUSH13/p0 1.16 1.15 -0.5% PASS
total/synth/PUSH13/p1 1.32 1.42 +7.5% PASS
total/synth/PUSH14/p0 1.08 1.17 +8.0% PASS
total/synth/PUSH14/p1 1.36 1.43 +5.2% PASS
total/synth/PUSH15/p0 1.15 1.15 +0.5% PASS
total/synth/PUSH15/p1 1.41 1.53 +8.1% PASS
total/synth/PUSH16/p0 0.99 1.02 +3.0% PASS
total/synth/PUSH16/p1 1.31 1.41 +8.2% PASS
total/synth/PUSH17/p0 1.15 1.10 -4.2% PASS
total/synth/PUSH17/p1 1.29 1.42 +9.6% PASS
total/synth/PUSH18/p0 1.23 1.15 -6.5% PASS
total/synth/PUSH18/p1 1.33 1.42 +6.4% PASS
total/synth/PUSH19/p0 1.15 1.01 -12.2% PASS
total/synth/PUSH19/p1 1.32 1.45 +9.6% PASS
total/synth/PUSH2/p0 0.99 1.15 +16.2% PASS
total/synth/PUSH2/p1 1.32 1.40 +6.3% PASS
total/synth/PUSH20/p0 1.16 1.00 -14.1% PASS
total/synth/PUSH20/p1 1.31 1.41 +7.5% PASS
total/synth/PUSH21/p0 1.15 1.15 +0.1% PASS
total/synth/PUSH21/p1 1.33 1.44 +8.6% PASS
total/synth/PUSH22/p0 1.22 1.23 +0.6% PASS
total/synth/PUSH22/p1 1.34 1.43 +7.1% PASS
total/synth/PUSH23/p0 0.99 1.07 +8.1% PASS
total/synth/PUSH23/p1 1.10 1.43 +29.1% PASS
total/synth/PUSH24/p0 1.15 1.15 +0.3% PASS
total/synth/PUSH24/p1 1.32 1.44 +8.7% PASS
total/synth/PUSH25/p0 1.23 1.15 -6.5% PASS
total/synth/PUSH25/p1 1.04 1.45 +39.0% PASS
total/synth/PUSH26/p0 1.15 1.15 +0.1% PASS
total/synth/PUSH26/p1 1.36 1.46 +7.2% PASS
total/synth/PUSH27/p0 1.15 1.15 +0.1% PASS
total/synth/PUSH27/p1 1.29 1.45 +12.1% PASS
total/synth/PUSH28/p0 1.15 1.12 -2.2% PASS
total/synth/PUSH28/p1 1.32 1.45 +9.5% PASS
total/synth/PUSH29/p0 1.15 1.15 +0.1% PASS
total/synth/PUSH29/p1 1.29 1.43 +11.1% PASS
total/synth/PUSH3/p0 0.99 1.15 +16.4% PASS
total/synth/PUSH3/p1 1.29 1.39 +8.1% PASS
total/synth/PUSH30/p0 1.16 1.17 +0.3% PASS
total/synth/PUSH30/p1 1.38 1.45 +4.8% PASS
total/synth/PUSH31/p0 1.01 0.99 -2.2% PASS
total/synth/PUSH31/p1 1.48 1.57 +6.4% PASS
total/synth/PUSH32/p0 0.99 1.07 +7.8% PASS
total/synth/PUSH32/p1 1.32 1.45 +9.7% PASS
total/synth/PUSH4/p0 0.99 1.09 +11.0% PASS
total/synth/PUSH4/p1 1.29 1.41 +9.5% PASS
total/synth/PUSH5/p0 0.99 0.91 -8.2% PASS
total/synth/PUSH5/p1 1.33 1.40 +5.7% PASS
total/synth/PUSH6/p0 0.99 1.15 +16.4% PASS
total/synth/PUSH6/p1 1.33 1.43 +7.6% PASS
total/synth/PUSH7/p0 1.15 0.99 -13.8% PASS
total/synth/PUSH7/p1 1.28 1.44 +12.0% PASS
total/synth/PUSH8/p0 1.15 1.15 +0.1% PASS
total/synth/PUSH8/p1 1.34 1.44 +7.0% PASS
total/synth/PUSH9/p0 1.15 1.15 -0.0% PASS
total/synth/PUSH9/p1 1.33 1.41 +6.5% PASS
total/synth/RETURNDATASIZE/a0 3.75 3.75 +0.1% PASS
total/synth/RETURNDATASIZE/a1 3.76 4.00 +6.4% PASS
total/synth/SAR/b0 3.77 3.83 +1.6% PASS
total/synth/SAR/b1 4.30 4.31 +0.2% PASS
total/synth/SGT/b0 2.60 2.61 +0.2% PASS
total/synth/SGT/b1 1.63 1.56 -4.7% PASS
total/synth/SHL/b0 3.03 3.02 -0.4% PASS
total/synth/SHL/b1 1.60 1.56 -2.5% PASS
total/synth/SHR/b0 2.93 2.93 -0.0% PASS
total/synth/SHR/b1 1.55 1.52 -2.5% PASS
total/synth/SIGNEXTEND/b0 3.02 3.46 +14.8% PASS
total/synth/SIGNEXTEND/b1 3.44 3.72 +8.2% PASS
total/synth/SLT/b0 2.59 2.60 +0.3% PASS
total/synth/SLT/b1 1.63 1.47 -9.9% PASS
total/synth/SUB/b0 1.98 1.99 +0.4% PASS
total/synth/SUB/b1 1.97 1.97 -0.1% PASS
total/synth/SWAP1/s0 1.49 1.49 -0.2% PASS
total/synth/SWAP10/s0 1.50 1.50 -0.0% PASS
total/synth/SWAP11/s0 1.50 1.51 +0.2% PASS
total/synth/SWAP12/s0 1.50 1.51 +0.0% PASS
total/synth/SWAP13/s0 1.51 1.51 -0.0% PASS
total/synth/SWAP14/s0 1.51 1.51 +0.1% PASS
total/synth/SWAP15/s0 1.51 1.51 -0.0% PASS
total/synth/SWAP16/s0 1.51 1.51 +0.1% PASS
total/synth/SWAP2/s0 1.49 1.49 +0.1% PASS
total/synth/SWAP3/s0 1.49 1.49 +0.2% PASS
total/synth/SWAP4/s0 1.49 1.50 +0.3% PASS
total/synth/SWAP5/s0 1.50 1.50 +0.1% PASS
total/synth/SWAP6/s0 1.50 1.50 +0.1% PASS
total/synth/SWAP7/s0 1.50 1.50 -0.1% PASS
total/synth/SWAP8/s0 1.50 1.50 -0.1% PASS
total/synth/SWAP9/s0 1.50 1.50 -0.1% PASS
total/synth/XOR/b0 1.55 1.55 +0.0% PASS
total/synth/XOR/b1 1.55 1.55 +0.1% PASS
total/synth/loop_v1 4.59 4.34 -5.3% PASS
total/synth/loop_v2 4.58 4.44 -3.0% PASS

Summary: 194 benchmarks, 0 regressions


✅ Performance Check Passed (multipass)

Performance Benchmark Results (threshold: 25%)

Benchmark Baseline (us) Current (us) Change Status
total/main/blake2b_huff/8415nulls 1.50 1.53 +1.8% PASS
total/main/blake2b_huff/empty 0.02 0.02 +0.7% PASS
total/main/blake2b_shifts/8415nulls 4.57 4.49 -1.7% PASS
total/main/sha1_divs/5311 0.62 0.61 -1.9% PASS
total/main/sha1_divs/empty 0.01 0.01 -2.0% PASS
total/main/sha1_shifts/5311 0.55 0.55 -0.7% PASS
total/main/sha1_shifts/empty 0.01 0.01 -0.8% PASS
total/main/snailtracer/benchmark 52.65 53.17 +1.0% PASS
total/main/structarray_alloc/nfts_rank 0.28 0.30 +4.7% PASS
total/main/swap_math/insufficient_liquidity 0.00 0.00 -2.7% PASS
total/main/swap_math/received 0.00 0.00 -1.7% PASS
total/main/swap_math/spent 0.00 0.00 -2.0% PASS
total/main/weierstrudel/1 0.29 0.28 -1.9% PASS
total/main/weierstrudel/15 3.16 3.14 -0.5% PASS
total/micro/JUMPDEST_n0/empty 0.00 0.00 -6.3% PASS
total/micro/jump_around/empty 0.09 0.05 -41.7% PASS
total/micro/loop_with_many_jumpdests/empty 0.00 0.00 +3.5% PASS
total/micro/memory_grow_mload/by1 0.08 0.08 +2.1% PASS
total/micro/memory_grow_mload/by16 0.09 0.09 +3.4% PASS
total/micro/memory_grow_mload/by32 0.11 0.11 +2.9% PASS
total/micro/memory_grow_mload/nogrow 0.08 0.08 +9.6% PASS
total/micro/memory_grow_mstore/by1 0.09 0.10 +6.5% PASS
total/micro/memory_grow_mstore/by16 0.10 0.10 +3.0% PASS
total/micro/memory_grow_mstore/by32 0.11 0.12 +3.4% PASS
total/micro/memory_grow_mstore/nogrow 0.09 0.09 +6.9% PASS
total/micro/signextend/one 0.23 0.23 +1.4% PASS
total/micro/signextend/zero 0.23 0.23 +0.8% PASS
total/synth/ADD/b0 0.00 0.00 +0.7% PASS
total/synth/ADD/b1 0.00 0.00 +0.6% PASS
total/synth/ADDRESS/a0 0.15 0.15 -0.4% PASS
total/synth/ADDRESS/a1 0.15 0.15 -0.4% PASS
total/synth/AND/b0 0.00 0.00 -0.0% PASS
total/synth/AND/b1 0.00 0.00 +0.3% PASS
total/synth/BYTE/b0 0.00 0.00 +0.3% PASS
total/synth/BYTE/b1 0.00 0.00 -0.3% PASS
total/synth/CALLDATASIZE/a0 0.07 0.07 +1.6% PASS
total/synth/CALLDATASIZE/a1 0.07 0.07 +3.7% PASS
total/synth/CALLER/a0 0.18 0.18 -0.0% PASS
total/synth/CALLER/a1 0.18 0.18 -0.3% PASS
total/synth/CALLVALUE/a0 0.26 0.26 -0.0% PASS
total/synth/CALLVALUE/a1 0.27 0.26 -2.5% PASS
total/synth/CODESIZE/a0 0.07 0.07 +1.5% PASS
total/synth/CODESIZE/a1 0.07 0.07 +3.7% PASS
total/synth/DUP1/d0 0.00 0.00 -0.0% PASS
total/synth/DUP1/d1 0.00 0.00 +0.0% PASS
total/synth/DUP10/d0 0.00 0.00 +0.2% PASS
total/synth/DUP10/d1 0.00 0.00 +0.5% PASS
total/synth/DUP11/d0 0.00 0.00 +0.1% PASS
total/synth/DUP11/d1 0.00 0.00 +0.6% PASS
total/synth/DUP12/d0 0.00 0.00 +0.1% PASS
total/synth/DUP12/d1 0.00 0.00 +0.4% PASS
total/synth/DUP13/d0 0.00 0.00 +0.2% PASS
total/synth/DUP13/d1 0.00 0.00 +0.4% PASS
total/synth/DUP14/d0 0.00 0.00 +0.1% PASS
total/synth/DUP14/d1 0.00 0.00 +0.1% PASS
total/synth/DUP15/d0 0.00 0.00 +0.2% PASS
total/synth/DUP15/d1 0.00 0.00 +0.1% PASS
total/synth/DUP16/d0 0.00 0.00 -0.0% PASS
total/synth/DUP16/d1 0.00 0.00 +0.6% PASS
total/synth/DUP2/d0 0.00 0.00 +0.6% PASS
total/synth/DUP2/d1 0.00 0.00 +0.2% PASS
total/synth/DUP3/d0 0.00 0.00 +0.5% PASS
total/synth/DUP3/d1 0.00 0.00 +0.2% PASS
total/synth/DUP4/d0 0.00 0.00 +0.4% PASS
total/synth/DUP4/d1 0.00 0.00 +0.1% PASS
total/synth/DUP5/d0 0.00 0.00 +0.4% PASS
total/synth/DUP5/d1 0.00 0.00 +0.1% PASS
total/synth/DUP6/d0 0.00 0.00 +0.2% PASS
total/synth/DUP6/d1 0.00 0.00 -0.0% PASS
total/synth/DUP7/d0 0.00 0.00 -0.2% PASS
total/synth/DUP7/d1 0.00 0.00 -0.4% PASS
total/synth/DUP8/d0 0.00 0.00 +0.1% PASS
total/synth/DUP8/d1 0.00 0.00 -0.2% PASS
total/synth/DUP9/d0 0.00 0.00 -0.0% PASS
total/synth/DUP9/d1 0.00 0.00 +0.1% PASS
total/synth/EQ/b0 0.00 0.00 +0.3% PASS
total/synth/EQ/b1 0.00 0.00 +0.3% PASS
total/synth/GAS/a0 0.78 0.76 -2.9% PASS
total/synth/GAS/a1 0.76 0.76 +0.9% PASS
total/synth/GT/b0 0.00 0.00 +0.1% PASS
total/synth/GT/b1 0.00 0.00 +0.1% PASS
total/synth/ISZERO/u0 0.00 0.00 +0.3% PASS
total/synth/JUMPDEST/n0 0.00 0.00 -5.9% PASS
total/synth/LT/b0 0.00 0.00 +0.5% PASS
total/synth/LT/b1 0.00 0.00 +0.0% PASS
total/synth/MSIZE/a0 0.00 0.00 -0.1% PASS
total/synth/MSIZE/a1 0.00 0.00 -0.3% PASS
total/synth/MUL/b0 0.00 0.00 -0.2% PASS
total/synth/MUL/b1 0.00 0.00 +0.1% PASS
total/synth/NOT/u0 0.00 0.00 +0.1% PASS
total/synth/OR/b0 0.00 0.00 +0.2% PASS
total/synth/OR/b1 0.00 0.00 +0.2% PASS
total/synth/PC/a0 0.00 0.00 +0.4% PASS
total/synth/PC/a1 0.00 0.00 +0.2% PASS
total/synth/PUSH1/p0 0.00 0.00 +0.3% PASS
total/synth/PUSH1/p1 0.00 0.00 -0.6% PASS
total/synth/PUSH10/p0 0.00 0.00 +0.5% PASS
total/synth/PUSH10/p1 0.00 0.00 +0.6% PASS
total/synth/PUSH11/p0 0.00 0.00 -0.2% PASS
total/synth/PUSH11/p1 0.00 0.00 -0.0% PASS
total/synth/PUSH12/p0 0.00 0.00 +0.2% PASS
total/synth/PUSH12/p1 0.00 0.00 -0.5% PASS
total/synth/PUSH13/p0 0.00 0.00 +0.2% PASS
total/synth/PUSH13/p1 0.00 0.00 +0.2% PASS
total/synth/PUSH14/p0 0.00 0.00 -0.3% PASS
total/synth/PUSH14/p1 0.00 0.00 +0.0% PASS
total/synth/PUSH15/p0 0.00 0.00 +0.3% PASS
total/synth/PUSH15/p1 0.00 0.00 +0.2% PASS
total/synth/PUSH16/p0 0.00 0.00 +0.2% PASS
total/synth/PUSH16/p1 0.00 0.00 -0.1% PASS
total/synth/PUSH17/p0 0.00 0.00 +0.2% PASS
total/synth/PUSH17/p1 0.00 0.00 -0.1% PASS
total/synth/PUSH18/p0 0.00 0.00 +0.3% PASS
total/synth/PUSH18/p1 0.00 0.00 +0.1% PASS
total/synth/PUSH19/p0 0.00 0.00 +0.0% PASS
total/synth/PUSH19/p1 0.00 0.00 +0.2% PASS
total/synth/PUSH2/p0 0.00 0.00 +0.1% PASS
total/synth/PUSH2/p1 0.00 0.00 +0.5% PASS
total/synth/PUSH20/p0 0.00 0.00 +0.3% PASS
total/synth/PUSH20/p1 0.00 0.00 +0.2% PASS
total/synth/PUSH21/p0 0.00 0.00 +0.2% PASS
total/synth/PUSH21/p1 0.00 0.00 +0.4% PASS
total/synth/PUSH22/p0 1.16 1.15 -1.4% PASS
total/synth/PUSH22/p1 1.34 1.44 +7.7% PASS
total/synth/PUSH23/p0 1.15 1.15 +0.1% PASS
total/synth/PUSH23/p1 1.35 1.46 +8.0% PASS
total/synth/PUSH24/p0 1.15 1.15 +0.1% PASS
total/synth/PUSH24/p1 1.34 1.45 +8.2% PASS
total/synth/PUSH25/p0 1.15 1.15 -0.0% PASS
total/synth/PUSH25/p1 1.34 1.42 +6.0% PASS
total/synth/PUSH26/p0 1.16 0.83 -28.3% PASS
total/synth/PUSH26/p1 1.34 1.44 +6.8% PASS
total/synth/PUSH27/p0 1.21 1.15 -5.3% PASS
total/synth/PUSH27/p1 1.34 1.45 +7.7% PASS
total/synth/PUSH28/p0 1.15 1.15 +0.1% PASS
total/synth/PUSH28/p1 1.35 1.44 +7.0% PASS
total/synth/PUSH29/p0 1.15 1.15 -0.0% PASS
total/synth/PUSH29/p1 1.34 1.43 +6.2% PASS
total/synth/PUSH3/p0 0.00 0.00 -0.3% PASS
total/synth/PUSH3/p1 0.00 0.00 -0.0% PASS
total/synth/PUSH30/p0 1.16 1.16 +0.0% PASS
total/synth/PUSH30/p1 1.35 1.44 +7.1% PASS
total/synth/PUSH31/p0 1.15 1.15 -0.1% PASS
total/synth/PUSH31/p1 1.48 1.58 +7.3% PASS
total/synth/PUSH32/p0 1.20 1.15 -4.3% PASS
total/synth/PUSH32/p1 1.35 1.46 +8.2% PASS
total/synth/PUSH4/p0 0.00 0.00 +0.0% PASS
total/synth/PUSH4/p1 0.00 0.00 +0.2% PASS
total/synth/PUSH5/p0 0.00 0.00 +0.3% PASS
total/synth/PUSH5/p1 0.00 0.00 +0.5% PASS
total/synth/PUSH6/p0 0.00 0.00 +0.1% PASS
total/synth/PUSH6/p1 0.00 0.00 +0.1% PASS
total/synth/PUSH7/p0 0.00 0.00 +0.3% PASS
total/synth/PUSH7/p1 0.00 0.00 -0.2% PASS
total/synth/PUSH8/p0 0.00 0.00 -0.0% PASS
total/synth/PUSH8/p1 0.00 0.00 -0.2% PASS
total/synth/PUSH9/p0 0.00 0.00 +1.2% PASS
total/synth/PUSH9/p1 0.00 0.00 -0.0% PASS
total/synth/RETURNDATASIZE/a0 0.03 0.03 +0.5% PASS
total/synth/RETURNDATASIZE/a1 0.03 0.03 +0.1% PASS
total/synth/SAR/b0 3.77 3.79 +0.5% PASS
total/synth/SAR/b1 4.29 4.32 +0.8% PASS
total/synth/SGT/b0 0.00 0.00 +0.2% PASS
total/synth/SGT/b1 0.00 0.00 +0.2% PASS
total/synth/SHL/b0 3.03 3.04 +0.2% PASS
total/synth/SHL/b1 1.60 1.56 -2.2% PASS
total/synth/SHR/b0 2.93 2.93 +0.0% PASS
total/synth/SHR/b1 1.55 1.52 -2.1% PASS
total/synth/SIGNEXTEND/b0 3.02 3.50 +16.1% PASS
total/synth/SIGNEXTEND/b1 3.21 3.55 +10.9% PASS
total/synth/SLT/b0 0.00 0.00 +0.3% PASS
total/synth/SLT/b1 0.00 0.00 +0.2% PASS
total/synth/SUB/b0 0.00 0.00 -0.1% PASS
total/synth/SUB/b1 0.00 0.00 +0.1% PASS
total/synth/SWAP1/s0 0.00 0.00 -0.6% PASS
total/synth/SWAP10/s0 0.00 0.00 +0.3% PASS
total/synth/SWAP11/s0 0.00 0.00 +0.4% PASS
total/synth/SWAP12/s0 0.00 0.00 +0.1% PASS
total/synth/SWAP13/s0 0.00 0.00 -0.0% PASS
total/synth/SWAP14/s0 0.00 0.00 +0.1% PASS
total/synth/SWAP15/s0 0.00 0.00 +0.0% PASS
total/synth/SWAP16/s0 0.00 0.00 +0.1% PASS
total/synth/SWAP2/s0 0.00 0.00 -0.0% PASS
total/synth/SWAP3/s0 0.00 0.00 +0.5% PASS
total/synth/SWAP4/s0 0.00 0.00 +0.2% PASS
total/synth/SWAP5/s0 0.00 0.00 -0.1% PASS
total/synth/SWAP6/s0 0.00 0.00 +0.2% PASS
total/synth/SWAP7/s0 0.00 0.00 +0.0% PASS
total/synth/SWAP8/s0 0.00 0.00 -0.2% PASS
total/synth/SWAP9/s0 0.00 0.00 -0.3% PASS
total/synth/XOR/b0 0.00 0.00 -0.2% PASS
total/synth/XOR/b1 0.00 0.00 -0.3% PASS
total/synth/loop_v1 1.17 1.18 +0.3% PASS
total/synth/loop_v2 1.10 1.10 +0.4% PASS

Summary: 194 benchmarks, 0 regressions


@abmcar
abmcar marked this pull request as ready for review March 29, 2026 05:51
@abmcar
abmcar requested a review from Copilot April 2, 2026 05:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/compiler/target/x86/x86lowering.cpp Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/compiler/evm_frontend/evm_mir_compiler.cpp
abmcar and others added 9 commits April 10, 2026 21:54
…st_cast

Add begin()/end() const overloads to MBasicBlock so read-only queries
can iterate statements without casting away const. Remove the const_cast
in isShortDiamondTrueFallthrough() that was only needed because const
iterators were missing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The compare-chain peephole (cmp->setcc->[movzx]->test->jne => cmp->jcc)
was erasing SETCC/MOVZX instructions without checking if their virtual
registers had other uses. The lowering cache (_expr_reg_map) can share
these registers across consumers, so erasing them could leave dangling
references. Add hasOneNonDBGUse guards to bail out when the registers
are still live.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…nd enum

Replace the separate bool field with ZERO_TEST_EQ/ZERO_TEST_NE enum
variants, eliminating a redundant state that could silently be inert
when DeferredValueKind was BITWISE_NOT.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@abmcar
abmcar force-pushed the perf/evm-peephole-rules branch from d781522 to e39b95f Compare April 10, 2026 13:58
@zoowii
zoowii merged commit fab344a into DTVMStack:main Apr 13, 2026
16 checks passed
@abmcar
abmcar deleted the perf/evm-peephole-rules branch April 14, 2026 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants