Repository navigation
Use WTOWorklist in ConstraintAnalysis and RedundantSetElimination - #9216
Merged
Merged
Conversation
Add `src/cfg/wto.h` with `WeakTopologicalOrdering` (`WTO`) and `WTOWorklist` built on top of `DomTree`. In a reducible CFG ordered in reverse postorder, every cycle is a natural loop headed by a block that dominates all blocks in the cycle, allowing a Bourdoncle Weak Topological Ordering to be constructed directly from the dominator tree and natural loops of the CFG. Include unit tests in `test/gtest/wto.cpp` and `TODO` comments noting follow-on optimizations.
Replace RPOQueue with WTOWorklist in ConstraintAnalysis and RedundantSetElimination so that loops stabilize before flow values propagate to downstream blocks. This avoids quadratic/cubic blowups on functions with sequential loops while also speeding up general workloads. Benchmark results across 16 WebAssembly modules (3 iterations): - --constraint-analysis: - esbuild.wasm: 381.60s -> 7.59s (-98.0%, 50.3x speedup) - 15 non-esbuild modules geomean: 1.564s -> 1.487s (-4.9%) - 15 non-esbuild modules total: 72.00s -> 57.24s (-20.5%) - All 16 modules geomean: 2.205s -> 1.646s (-25.4%) - All 16 modules total: 453.60s -> 64.83s (-85.7%) - --rse: - esbuild.wasm: >600s (timeout) -> 1.62s (>370x speedup) - 15 non-esbuild modules total: 26.40s -> 25.47s (-3.5%) - All 16 modules geomean: N/A -> 0.922s (total: 27.09s)
kripken
approved these changes
Oct 7, 2026
kripken
left a comment
Member
There was a problem hiding this comment.
Well that is some compelling data!
Member
|
ccing #4165 as this makes compilation faster |
# Conflicts: # test/gtest/wto.cpp
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.
Replace RPOQueue with WTOWorklist in ConstraintAnalysis and
RedundantSetElimination so that loops stabilize before flow values
propagate to downstream blocks. This avoids quadratic/cubic blowups on
functions with sequential loops while also speeding up general workloads.
Benchmark results across 16 WebAssembly modules (3 iterations):