1 ; RUN: llc -mtriple=x86_64-pc-windows-msvc < %s | FileCheck %s
3 declare i32 @__CxxFrameHandler3(...)
8 define i16 @test1(i16 %a, i8* %b) personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
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 [i8* null, i32 8, i8* null]
26 call void @throw() noreturn
30 catchpad within %cs [i8* null, i32 64, i8* 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, i8* %b) personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
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 [i8* null, i32 8, i8* null]
68 call void @throw() noreturn
72 %c2 = catchpad within %cs [i8* null, i32 32, i8* null]
74 catchret from %c2 to label %cleanup
77 %c3 = catchpad within %cs [i8* null, i32 64, i8* 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;