brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.9 KiB · 3059a70 Raw
160 lines · plain
1; RUN: llc -mtriple=x86_64-pc-windows-msvc < %s | FileCheck %s2 3declare i32 @__CxxFrameHandler3(...)4 5declare void @throw()6declare i16 @f()7 8define i16 @test1(i16 %a, ptr %b) personality ptr @__CxxFrameHandler3 {9entry:10  %cmp = icmp eq i16 %a, 1011  br i1 %cmp, label %if.then, label %if.else12 13if.then:14  %call1 = invoke i16 @f()15          to label %cleanup unwind label %catch.dispatch16 17if.else:18  %call2 = invoke i16 @f()19          to label %cleanup unwind label %catch.dispatch20 21catch.dispatch:22  %cs = catchswitch within none [ label %catch, label %catch.2 ] unwind to caller23 24catch:25  catchpad within %cs [ptr null, i32 8, ptr null]26  call void @throw() noreturn27  br label %unreachable28 29catch.2:30  catchpad within %cs [ptr null, i32 64, ptr null]31  store i8 1, ptr %b32  call void @throw() noreturn33  br label %unreachable34 35cleanup:36  %retval = phi i16 [ %call1, %if.then ], [ %call2, %if.else ]37  ret i16 %retval38 39unreachable:40  unreachable41}42 43; This test verifies the case where two funclet blocks meet the old criteria44; to be placed at the end.  The order of the blocks is not important for the45; purposes of this test.  The failure mode is an infinite loop during46; compilation.47;48; CHECK-LABEL: .def     test1;49 50define i16 @test2(i16 %a, ptr %b) personality ptr @__CxxFrameHandler3 {51entry:52  %cmp = icmp eq i16 %a, 1053  br i1 %cmp, label %if.then, label %if.else54 55if.then:56  %call1 = invoke i16 @f()57          to label %cleanup unwind label %catch.dispatch58 59if.else:60  %call2 = invoke i16 @f()61          to label %cleanup unwind label %catch.dispatch62 63catch.dispatch:64  %cs = catchswitch within none [ label %catch, label %catch.2, label %catch.3 ] unwind to caller65 66catch:67  catchpad within %cs [ptr null, i32 8, ptr null]68  call void @throw() noreturn69  br label %unreachable70 71catch.2:72  %c2 = catchpad within %cs [ptr null, i32 32, ptr null]73  store i8 1, ptr %b74  catchret from %c2 to label %cleanup75 76catch.3:77  %c3 = catchpad within %cs [ptr null, i32 64, ptr null]78  store i8 2, ptr %b79  catchret from %c3 to label %cleanup80 81cleanup:82  %retval = phi i16 [ %call1, %if.then ], [ %call2, %if.else ], [ -1, %catch.2 ], [ -1, %catch.3 ]83  ret i16 %retval84 85unreachable:86  unreachable87}88 89; This test verifies the case where three funclet blocks all meet the old90; criteria to be placed at the end.  The order of the blocks is not important91; for the purposes of this test.  The failure mode is an infinite loop during92; compilation.93;94; CHECK-LABEL: .def     test2;95 96declare void @g()97 98define void @test3() optsize personality ptr @__CxxFrameHandler3 {99entry:100  switch i32 undef, label %if.end57 [101    i32 64, label %sw.bb102    i32 128, label %sw.epilog103    i32 256, label %if.then56104    i32 1024, label %sw.bb105    i32 4096, label %sw.bb33106    i32 16, label %sw.epilog107    i32 8, label %sw.epilog108    i32 32, label %sw.bb44109  ]110 111sw.bb:112  unreachable113 114sw.bb33:115  br i1 undef, label %if.end57, label %while.cond.i163.preheader116 117while.cond.i163.preheader:118  unreachable119 120sw.bb44:121  %temp0 = load ptr, ptr undef122  invoke void %temp0()123          to label %if.end57 unwind label %catch.dispatch124 125sw.epilog:126  %temp1 = load ptr, ptr undef127  br label %if.end57128 129catch.dispatch:130  %cs = catchswitch within none [label %catch1, label %catch2, label %catch3] unwind to caller131 132catch1:133  %c1 = catchpad within %cs [ptr null, i32 8, ptr null]134  unreachable135 136catch2:137  %c2 = catchpad within %cs [ptr null, i32 32, ptr null]138  unreachable139 140catch3:141  %c3 = catchpad within %cs [ptr null, i32 64, ptr null]142  unreachable143 144if.then56:145  call void @g()146  br label %if.end57147 148if.end57:149  ret void150}151 152; This test exercises a complex case that produced an infinite loop during153; compilation when the two cases above did not. The multiple targets from the154; entry switch are not actually fundamental to the failure, but they are155; necessary to suppress various control flow optimizations that would prevent156; the conditions that lead to the failure.157;158; CHECK-LABEL: .def     test3;159 160