-
Notifications
You must be signed in to change notification settings - Fork 24
perf(compiler): add EVM peepholes and branch shaping #435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
512a7e5
perf(evm): add frontend peephole identities
abmcar fe4f1e9
perf(compiler): add EVM peepholes and branch shaping
abmcar 43374e9
chore(docs): remove next optimization prompt
abmcar cfc9d84
chore(ci): rerun workflows
abmcar f4a9eb2
chore(ci): rerun workflows
abmcar 14cc393
refactor(compiler): add const iterators to MBasicBlock and remove con…
abmcar 003c613
fix(compiler): add liveness check before erasing SETCC/MOVZX in peephole
abmcar b386f9c
refactor(compiler): fold DeferredZeroTestNegated bool into DeferredKi…
abmcar e39b95f
docs(compiler): add change document for EVM peepholes and branch shaping
abmcar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
docs/changes/2026-03-27-evm-peepholes-branch-shaping/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # Change: EVM peepholes and branch shaping | ||
|
|
||
| - **Status**: Implemented | ||
| - **Date**: 2026-03-27 | ||
| - **Tier**: Light | ||
|
|
||
| ## Overview | ||
|
|
||
| Add EVM frontend peepholes for zero/one/all-ones identities in ADD, SUB, MUL, AND, OR, 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. | ||
|
|
||
| ## Motivation | ||
|
|
||
| The EVM frontend mechanically expands all operations to full 256-bit MIR regardless of operand values. Identity operations (add 0, mul 1, and all-ones, etc.) generate unnecessary instructions that are trivially eliminable at the frontend level. | ||
|
|
||
| ## Impact | ||
|
|
||
| - Modules: `docs/modules/compiler/` (EVM frontend + x86 lowering) | ||
| - 5 files changed in `src/compiler/evm_frontend/` and `src/compiler/target/x86/` | ||
| - Benchmark geomean: +11.4%, total time reduction ~3.8% | ||
| - Notable: jump_around/empty ~48% faster | ||
| - 1798/1798 state tests pass | ||
|
|
||
| ## Checklist | ||
|
|
||
| - [x] Implementation complete | ||
| - [x] Tests added/updated | ||
| - [ ] Module specs in `docs/modules/` updated (if affected) | ||
| - [x] Build and tests pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.