[llvm] [WebAssembly] Use `MachineCycleInfo` in `WebAssemblyFixIrreducibleControlFlow` (PR #182237)

Demetrius Kanios via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 19 01:08:45 PST 2026


QuantumSegfault wrote:

This seems to be even faster in compiling in some cases (but the difference is pretty insignficant compared to the massive gains of adopting either PR). Most of the work is offloaded to the analysis pass, and in cases with no irreducibility, we are left with nothing to do!

The downside of this is that we change the generated code. It seems to preserve loop nesting better, to the benefit of potential runtime performance(?) (tighter, well defined `loop`s vs larger tangles of `br_table` being able to jump where-ever; but that's just my speculation, not measurement). This comes at the cost of larger code-size. Here's some graphs showing how the two approaches compare on `@pi_next` from `test/CodeGen/WebAssembly/irreducible_cfg.ll`

Before:
[irreducible_pi_next](https://github.com/user-attachments/assets/80102a69-1d6b-4a69-8d9b-e9102374912d)

With this PR:
[cycleinfo_pi_next](https://github.com/user-attachments/assets/77e90949-2e84-4065-b3f1-b1a610b8d63e)

With old approach and #181755:
[scc_pi_next](https://github.com/user-attachments/assets/a713b2d7-867d-4352-9d75-4cee7c6c5b22)


https://github.com/llvm/llvm-project/pull/182237


More information about the llvm-commits mailing list