wraitii opened PR #15346 from wraitii:fix/licm-loop-membership to bytecodealliance:main:
Fixes #15335, implementing @cfallin 's suggestion.
LICM checks whether a block belongs to each candidate loop before hoisting. Walking the loop’s parents for every check made compilation quadratic in loop depth on the reported example. Numbering the loop forest once makes each membership check constant time and preserves the hoist points.
On arm64, the issue’s depth-1,000 case went from 25.33 s to 0.074 s, and depth 2,000 went from 109.58 s to 0.157 s, so this matches the pre-regression numbers.
--
PR written by Sol 6.2 . It also explored just reversing the if conditions, which helped significantly but wasn't as good as this approach. The bad case for that approach is sequential loops, not nested, which is probably less common.
--
Sightglass report vs pre-#15335 has nothing significant on compile-time (except for shootout-switch, which is still 3x faster than before, but that is also true on main).
wraitii removed the review request for wasmtime-compiler-reviewers from PR #15346.
wraitii requested cfallin for a review on PR #15346.
wraitii requested wasmtime-compiler-reviewers for a review on PR #15346.
github-actions[bot] added the label cranelift on PR #15346.
:thumbs_up: cfallin submitted PR review:
Thanks a bunch!
cfallin added PR #15346 Cranelift: make loop membership checks constant time to the merge queue.
:check: cfallin merged PR #15346.
cfallin removed PR #15346 Cranelift: make loop membership checks constant time from the merge queue.
Last updated: Nov 19 2026 at 20:05 UTC