[llvm] [WebAssembly] Incorporate SCCs into WebAssemblyFixIrreducibleControlFlow (PR #181755)

Demetrius Kanios via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 3 12:07:07 PST 2026


QuantumSegfault wrote:

Well, it took me a long time to remember that `llc` defaults to `-O2` while `clang -cc1` defaults to `-O0`, but I've finally got it boiled down:
```ll
target triple = "wasm32-unknown-unknown"

define hidden void @test() {
entry:
 switch i32 poison, label %b [
    i32 0, label %a
  ]

a:
  ret void

b:
    unreachable
}
```

For some reason the very specific case of having an `unreachable` instruction as the direct default target of a switch at `-O0` causes the assertion to fail. Moving the unreachable inside the switch doesn't do it. Inserting another instruction between the `unreachable` and `b` doesn't do it. Any other optimization level doesn't do it.



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


More information about the llvm-commits mailing list