xref: /llvm-project/llvm/test/Transforms/SimpleLoopUnswitch/catchswitch.ll (revision 2f79f5438cd6f4fa0fdc32458911c2d163f917c0)
1; RUN: opt -passes='simple-loop-unswitch<nontrivial>' < %s -S | FileCheck %s
2
3; CHECK: if.end{{.*}}:
4; CHECK-NOT: if.end{{.*}}:
5declare i32 @__gxx_wasm_personality_v0(...)
6
7declare void @foo()
8
9define void @test(i1 %arg) personality ptr @__gxx_wasm_personality_v0 {
10entry:
11  br label %while.body
12
13while.body:                                       ; preds = %cleanup, %entry
14  br i1 %arg, label %if.end, label %if.then
15
16if.then:                                          ; preds = %while.body
17  br label %if.end
18
19if.end:                                           ; preds = %if.then, %while.body
20  invoke void @foo()
21          to label %cleanup unwind label %catch.dispatch
22
23catch.dispatch:                                   ; preds = %invoke.cont, %if.end
24  %0 = catchswitch within none [label %catch] unwind to caller
25
26catch:                                            ; preds = %catch.dispatch
27  %1 = catchpad within %0 [ptr null]
28  unreachable
29
30cleanup:                                          ; preds = %invoke.cont
31  br label %while.body
32}
33
34