镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Collapse inner loops with union-find during WTO construction - #9218

Open
tlively wants to merge 2 commits into
domtree-block-indicesfrom
wto-union-find
Open

tlively wants to merge 2 commits into
domtree-block-indicesfrom
wto-union-find

Conversation

@tlively

@tlively tlively commented Oct 6, 2026

Copy link
Copy Markdown
Member

During reverse-RPO natural loop discovery in WeakTopologicalOrdering,
collapse each discovered loop body into its header using union-find with
path compression, and skip over already-collapsed inner loops when
walking immediate dominators in dominates(). This prevents outer loops
from re-traversing inner loop bodies, bounding natural loop discovery to
O(E alpha(N)) instead of O(N * depth) on deeply nested loops.

Benchmark results across 16 WebAssembly modules (3 iterations,
interleaved):

  • --constraint-analysis:
    • Geomean: 1.576s -> 1.564s (-0.7%)
    • Total time: 62.82s -> 62.40s (-0.7%)
  • --rse:
    • Geomean: 0.859s -> 0.853s (-0.7%)
    • Total time: 25.40s -> 25.06s (-1.3%)

During reverse-RPO natural loop discovery in WeakTopologicalOrdering,
collapse each discovered loop body into its header using union-find with
path compression, and skip over already-collapsed inner loops when
walking immediate dominators in dominates(). This prevents outer loops
from re-traversing inner loop bodies, bounding natural loop discovery to
O(E alpha(N)) instead of O(N * depth) on deeply nested loops.

Benchmark results across 16 WebAssembly modules (3 iterations,
interleaved):
- --constraint-analysis:
  - Geomean: 1.576s -> 1.564s (-0.7%)
  - Total time: 62.82s -> 62.40s (-0.7%)
- --rse:
  - Geomean: 0.859s -> 0.853s (-0.7%)
  - Total time: 25.40s -> 25.06s (-1.3%)
@tlively
tlively requested a review from a team as a code owner October 6, 2026 07:10
@tlively
tlively requested review from kripken and removed request for a team October 6, 2026 07:10

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant