pnodet opened PR #11596 from pnodet:pnodet-6 to bytecodealliance:main:
This PR aims at merging
DominatorTreePreorderfunctionality directly intoDominatorTree, eliminating duplicate computation and providing O(1) block dominance checks by default.Previously, Cranelift had two separate dominator tree interfaces:
-
DominatorTree: Basic dominance with O(depth) block dominance checks
-DominatorTreePreorder: Fast O(1) block dominance via preorder numberingChanges
- Added preorder fields to
DominatorTreeNode(child, sibling, dom_pre_number, dom_pre_max)
- Integrated preorder computation into maincompute()method
- Replaced O(n)block_dominateswith O(1) implementation using preorder numbers
- Addedchildren()iterator for dominator tree traversal
- RemovedDominatorTreePreorderstruct entirelyCloses https://github.com/bytecodealliance/wasmtime/issues/7954
pnodet requested alexcrichton for a review on PR #11596.
pnodet requested wasmtime-compiler-reviewers for a review on PR #11596.
alexcrichton requested cfallin for a review on PR #11596.
cfallin submitted PR review:
Thanks very much for doing this cleanup!
A few comments below but nothing major...
cfallin created PR review comment:
Why clone the postorder vec here? It looks like it's borrowed only while mutating other fields (
nodes,dfs_worklist) below so the borrow checker should be able to understand the lack of borrow conflict...
cfallin created PR review comment:
To avoid polluting the diff, could you keep this at the same point in the file? It looks like it's otherwise unmodified (modulo the type renaming).
cfallin created PR review comment:
No need to use the
inst_blockmethod here --pred.blockis available (as shown a few lines below).Likewise above around line 205.
cfallin created PR review comment:
nit -- rustdoc format is usually a single summary line, then a blank
///line, then the details.
pnodet submitted PR review.
pnodet created PR review comment:
Indeed I may have been overly cautious there
pnodet updated PR #11596.
pnodet submitted PR review.
pnodet created PR review comment:
Thanks, changes are now at https://github.com/bytecodealliance/wasmtime/pull/11596/files#diff-b490f64fce5d44b4375aa866ddbb675869cb30c3044e818e6533271f409f5bc5L543 and way more readable
pnodet commented on PR #11596:
@cfallin Thanks for the review, made a few changes for the things you pointed out
cfallin submitted PR review.
cfallin has enabled auto merge for PR #11596.
cfallin merged PR #11596.
Last updated: Dec 06 2025 at 07:03 UTC