xixi-box opened PR #15269 from xixi-box:fix/issue-15264-68f6475-c0075eaa to bytecodealliance:main:
Fixes #15264
Root cause: Egraph elaboration sinks the running sum to its final use, keeping call results live across subsequent calls and causing quadratic register allocation work.
<!-- oss-scout-job:job-4662e4ff-fcf3-4df0-a0a9-c0075eaa5d06 -->
Tests:
cargo run -p cranelift-tools --bin clif-util -- test -v cranelift/filetests/filetests/egraph/running-sum.clif(fails on base; passes with this patch).
Regression coverage:cranelift/filetests/filetests/egraph/running-sum.clif.AI assistance: Codex helped implement and test this change. oss-scout independently replayed the regression before opening this PR.
xixi-box removed the review request for wasmtime-compiler-reviewers from PR #15269.
xixi-box requested wasmtime-compiler-reviewers for a review on PR #15269.
xixi-box requested cfallin for a review on PR #15269.
github-actions[bot] added the label cranelift on PR #15269.
xixi-box commented on PR #15269:
The
Test Linux x86_64 (wasmtime-cli-other)failure is a systematic expectation drift, not flakiness: all 276 failing tests are disas golden-file tests (tests/disas/**, mostly load-store and gc) whose expected CLIF no longer matches becauseplace_earlynow sinks pure instructions to just after their latest operand (e.g.array-fill-anyrefgainsv14 = uextend.i64 v3beforetrapzin block0).That is the intended effect of the fix (shortening operand live ranges changes scheduling), so the expectations need regeneration rather than code changes:
WASMTIME_TEST_BLESS=1 cargo test -p wasmtime-cli --test disasI have not pushed the blessed output yet — with a change that broad it is probably worth a maintainer call first: if the reordering is acceptable, I will follow up with the regenerated files in a second commit; if some reordering is undesirable (e.g. instructions sinking past bounds checks), that would need refinement in
place_earlyinstead.
cfallin commented on PR #15269:
Thanks. I don't think we will take this PR, for several reasons:
- It adds quite a significant bit of complexity trying to lift instructions "early"; I'd rather that you discuss with us, in Zulip or in an issue here (and as a human, with no AI-generated reasoning), what you are planning to do.
- The complexity also likely adds nontrivial compile time and you haven't evaluated that at all. This may be masked by better IR reaching regalloc but we don't want to create hidden cost here.
- As explained elsewhere, avoiding all quadratic behavior in an optimizing compiler is simply not feasible: many of the underlying algorithms (such as liveness computation and iterative dataflow analysis in general) are fundamentally super-linear, and chasing all of these with the expectation of eliminating all of them is a fool's errand (IMHO and in the opinion of most compiler engineers).
- You don't appear to have invested significant effort to actually understand what's going on, or to pre-filter this work before presenting it to us; the above comments appear AI-generated, which is against our policies and presents us an "extractive contribution" where we have to do more work than you have to actually understand and judge the work. A healthy project should expect contributors to respect maintainers' time and not throw unfiltered work at them.
For all these reasons I am going to close this PR, but please feel free to discuss with us at a Cranelift project meeting if you want to further pursue work on the egraph implementation. Thanks!
:cross_mark: cfallin closed without merge PR #15269.
Last updated: Nov 19 2026 at 20:05 UTC