1 ; RUN: llc -mtriple=x86_64-pc-windows-msvc < %s | FileCheck %s
3 declare i32 @__CxxFrameHandler3(...)
8 define i16 @test1(i16 %a, ptr %b) personality ptr @__CxxFrameHandler3 {
10 %cmp = icmp eq i16 %a, 10
11 br i1 %cmp, label %if.then, label %if.else
14 %call1 = invoke i16 @f()
15 to label %cleanup unwind label %catch.dispatch
18 %call2 = invoke i16 @f()
19 to label %cleanup unwind label %catch.dispatch
22 %cs = catchswitch within none [ label %catch, label %catch.2 ] unwind to caller
25 catchpad within %cs [ptr null, i32 8, ptr null]
26 call void @throw() noreturn
30 catchpad within %cs [ptr null, i32 64, ptr null]
32 call void @throw() noreturn
36 %retval = phi i16 [ %call1, %if.then ], [ %call2, %if.else ]
43 ; This test verifies the case where two funclet blocks meet the old criteria
44 ; to be placed at the end. The order of the blocks is not important for the
45 ; purposes of this test. The failure mode is an infinite loop during
48 ; CHECK-LABEL: .def test1;
50 define i16 @test2(i16 %a, ptr %b) personality ptr @__CxxFrameHandler3 {
52 %cmp = icmp eq i16 %a, 10
53 br i1 %cmp, label %if.then, label %if.else
56 %call1 = invoke i16 @f()
57 to label %cleanup unwind label %catch.dispatch
60 %call2 = invoke i16 @f()
61 to label %cleanup unwind label %catch.dispatch
64 %cs = catchswitch within none [ label %catch, label %catch.2, label %catch.3 ] unwind to caller
67 catchpad within %cs [ptr null, i32 8, ptr null]
68 call void @throw() noreturn
72 %c2 = catchpad within %cs [ptr null, i32 32, ptr null]
74 catchret from %c2 to label %cleanup
77 %c3 = catchpad within %cs [ptr null, i32 64, ptr null]
79 catchret from %c3 to label %cleanup
82 %retval = phi i16 [ %call1, %if.then ], [ %call2, %if.else ], [ -1, %catch.2 ], [ -1, %catch.3 ]
89 ; This test verifies the case where three funclet blocks all meet the old
90 ; criteria to be placed at the end. The order of the blocks is not important
91 ; for the purposes of this test. The failure mode is an infinite loop during
94 ; CHECK-LABEL: .def test2;
98 define void @test3() optsize personality ptr @__CxxFrameHandler3 {
100 switch i32 undef, label %if.end57 [
102 i32 128, label %sw.epilog
103 i32 256, label %if.then56
104 i32 1024, label %sw.bb
105 i32 4096, label %sw.bb33
106 i32 16, label %sw.epilog
107 i32 8, label %sw.epilog
108 i32 32, label %sw.bb44
115 br i1 undef, label %if.end57, label %while.cond.i163.preheader
117 while.cond.i163.preheader:
121 %temp0 = load ptr, ptr undef
123 to label %if.end57 unwind label %catch.dispatch
126 %temp1 = load ptr, ptr undef
130 %cs = catchswitch within none [label %catch1, label %catch2, label %catch3] unwind to caller
133 %c1 = catchpad within %cs [ptr null, i32 8, ptr null]
137 %c2 = catchpad within %cs [ptr null, i32 32, ptr null]
141 %c3 = catchpad within %cs [ptr null, i32 64, ptr null]
152 ; This test exercises a complex case that produced an infinite loop during
153 ; compilation when the two cases above did not. The multiple targets from the
154 ; entry switch are not actually fundamental to the failure, but they are
155 ; necessary to suppress various control flow optimizations that would prevent
156 ; the conditions that lead to the failure.
158 ; CHECK-LABEL: .def test3;