wraitii opened PR #15184 from wraitii:fix/egraph-source-locations to bytecodealliance:main:
Found an issue with source tracking while working on a custom jitdump project connected to samply.
The investigation & fix were entirely found by GPT Astra, so I cannot vouch for its particular accuracy, but the diff is small and seems to check out for the issue.
Let me know if I should change something here.Description
The egraph elaborator clones instructions during rematerialization and expression placement, but
dfg.clone_instdoes not copy the separate source-location entry. Surviving instructions can therefore lose their locations, leaving gaps in profiling attribution.Copy non-default source locations at both clone sites. Skipping default locations avoids populating an otherwise empty source-location map.
The regression test checks locations on rematerialized constants and their cloned users. Removing either fix independently makes it fail.
Validation:
- All 1,400 Cranelift filetests pass with
all-arch.cargo fmt --all -- --checkpasses.
wraitii removed the review request for wasmtime-compiler-reviewers from PR #15184.
wraitii requested cfallin for a review on PR #15184.
wraitii requested wasmtime-compiler-reviewers for a review on PR #15184.
:thumbs_up: cfallin submitted PR review:
Thanks!
It looks like you'll have to re-bless a bunch of disas tests since more sourcelocs are preserved through optimizations now. Can you do that in a separate commit? I'll then read through it to make sure nothing else changed, and merge after that.
github-actions[bot] added the label cranelift on PR #15184.
wraitii requested dicej for a review on PR #15184.
wraitii removed the review request for wasmtime-core-reviewers from PR #15184.
wraitii requested wasmtime-core-reviewers for a review on PR #15184.
wraitii updated PR #15184.
wraitii commented on PR #15184:
Done in a separate commit, ready for review :)
:thumbs_up: cfallin submitted PR review:
Thanks!
cfallin added PR #15184 Cranelift: preserve source locations during egraph elaboration to the merge queue.
:check: cfallin merged PR #15184.
cfallin removed PR #15184 Cranelift: preserve source locations during egraph elaboration from the merge queue.
Last updated: Nov 19 2026 at 20:05 UTC