1; RUN: opt -passes=simple-loop-unswitch -enable-nontrivial-unswitch < %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 i8* bitcast (i32 (...)* @__gxx_wasm_personality_v0 to i8*) {
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 [i8* null]
28  unreachable
29
30cleanup:                                          ; preds = %invoke.cont
31  br label %while.body
32}
33
34