Fe trace attribution and EVM PC mapping - #301
Open
cburgdorf wants to merge 3 commits into
Open
Conversation
Store frontend origins and post-optimization provenance as shared per-instruction attribution. Preserve the bundle through replacement passes and both inliners, clear it with erased instructions, and leave pass-created instructions unattributed when no valid anchor exists. Co-authored-by: Micah Scopes <micahscopes@gmail.com>
Provide deterministic function, block, instruction, CFG-edge, and instruction-kind views for Fe trace emission. Let frontend consumers inspect and stamp the optimized module before EVM backend preparation. Co-authored-by: Micah Scopes <micahscopes@gmail.com>
Carry exact post-optimization provenance through machine lowering into byte-reconciled PC ranges. Keep synthesized glue separate, account explicitly for unmapped bytes, and allocate synthetic function identities after all real module functions. Co-authored-by: Micah Scopes <micahscopes@gmail.com>
cburgdorf
force-pushed
the
trace-debug-rebase
branch
from
July 21, 2026 13:33
f2112ef to
9d9325e
Compare
cburgdorf
marked this pull request as ready for review
August 11, 2026 08:45
Collaborator
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Collaborator
Author
|
@micahscopes @sbillig These changes are needed for tracing to work post-optimization. It's based on @micahscopes 's initial work. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Add the minimal Sonatina substrate required by Fe's
ethdebug-distillwork:This is intentionally scoped to Fe's trace pipeline rather than being a general-purpose debug-info framework.
Design
Each instruction can carry two independent optional attribution channels:
Attribution strings use shared
Arc<str>storage. Inlining and machine lowering therefore preserve identity without duplicating long frontend keys per instruction.Function::propagate_inst_attributioncopies both channels when a pass replaces or expands an instruction. This contract is used by the relevant optimizer passes and both inliners.Trace views
The PR exposes deterministic, panic-free views over:
It also exposes the optimized module before backend preparation so Fe can emit post-optimization trace facts and stamp instruction provenance.
EVM observability
EVM lowering distinguishes between:
The object layer emits byte-reconciled PC ranges with either:
Synthetic observability units are numbered after all real module functions, avoiding identity collisions.
Attribution correctness
The PR also fixes incorrect attribution in branch canonicalization: replacement compares now inherit attribution from the compare they replace, rather than borrowing it from the enclosing branch.
Missing attribution remains missing. Instructions created without a valid attribution anchor are deliberately left unmapped instead of borrowing nearby provenance.
Known uncovered creation sites remain in parts of aggregate/ABI transformation and GVN/LSR/CFG-edit phi construction.
Verification
Sonatina:
cargo test -p sonatina-ircargo test -p sonatina-codegenFe, using a temporary local Cargo patch:
cargo test -p fe-codegencargo test -p fe