165 lines · plain
1; RUN: llc -mtriple=x86_64-windows-msvc < %s | FileCheck %s2 3target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"4target triple = "x86_64-pc-windows-msvc"5 6%eh.ThrowInfo = type { i32, i32, i32, i32 }7%rtti.TypeDescriptor2 = type { ptr, ptr, [3 x i8] }8 9@"\01??_7type_info@@6B@" = external constant ptr10@"\01??_R0H@8" = internal global %rtti.TypeDescriptor2 { ptr @"\01??_7type_info@@6B@", ptr null, [3 x i8] c".H\00" }11 12declare void @llvm.trap()13 14define void @test1(i1 %B) personality ptr @__CxxFrameHandler3 {15entry:16 invoke void @g()17 to label %unreachable unwind label %catch.dispatch18 19catch.dispatch:20 %cs1 = catchswitch within none [label %catch] unwind to caller21 22catch:23 %cp = catchpad within %cs1 [ptr null, i32 64, ptr null]24 br label %catch.loop25 26catch.loop:27 br i1 %B, label %catchret, label %catch.loop28 29catchret:30 catchret from %cp to label %try.cont31 32try.cont:33 ret void34 35unreachable:36 call void @llvm.trap()37 unreachable38}39 40; CHECK-LABEL: test1:41 42; The entry funclet contains %entry and %try.cont43; CHECK: # %entry44; CHECK: # %try.cont45; CHECK: retq46 47; The catch funclet contains %catch and %catchret48; CHECK: # %catch{{$}}49; CHECK: # %catchret50; CHECK: retq51 52declare void @g()53 54 55define i32 @test2(i1 %B) personality ptr @__CxxFrameHandler3 {56entry:57 invoke void @_CxxThrowException(ptr null, ptr null) #158 to label %unreachable unwind label %catch.dispatch59 60catch.dispatch: ; preds = %entry61 %cs1 = catchswitch within none [label %catch] unwind to caller62 63catch: ; preds = %catch.dispatch64 %0 = catchpad within %cs1 [ptr null, i32 64, ptr null]65 invoke void @_CxxThrowException(ptr null, ptr null) #1 ["funclet"(token %0)]66 to label %unreachable unwind label %catch.dispatch.167 68catch.dispatch.1: ; preds = %catch69 %cs2 = catchswitch within %0 [label %catch.3] unwind to caller70 71catch.3: ; preds = %catch.dispatch.172 %1 = catchpad within %cs2 [ptr null, i32 64, ptr null]73 catchret from %1 to label %try.cont74 75try.cont: ; preds = %catch.376 catchret from %0 to label %try.cont.577 78try.cont.5: ; preds = %try.cont79 ret i32 080 81unreachable: ; preds = %catch, %entry82 call void @llvm.trap()83 unreachable84}85 86; CHECK-LABEL: test2:87 88; The parent function contains %entry and %try.cont.589; CHECK: .seh_proc90; CHECK: # %entry91; CHECK: # %try.cont.592; CHECK: retq93 94; The inner catch funclet contains %catch.395; CHECK: .seh_proc96; CHECK: # %catch.3{{$}}97; CHECK: retq98 99; The outer catch funclet contains %catch100; CHECK: .seh_proc101; CHECK: # %catch{{$}}102; CHECK: callq _CxxThrowException103; CHECK: # %unreachable104; CHECK: ud2105 106 107define void @test3(i1 %V) #0 personality ptr @__CxxFrameHandler3 {108entry:109 invoke void @g()110 to label %try.cont unwind label %catch.dispatch111 112catch.dispatch: ; preds = %entry113 %cs1 = catchswitch within none [label %catch.2] unwind label %catch.dispatch.1114 115catch.2: ; preds = %catch.dispatch116 %0 = catchpad within %cs1 [ptr @"\01??_R0H@8", i32 0, ptr null]117 tail call void @exit(i32 0) #2 [ "funclet"(token %0) ]118 unreachable119 120catch.dispatch.1: ; preds = %catch.dispatch121 %cs2 = catchswitch within none [label %catch] unwind to caller122 123catch: ; preds = %catch.dispatch.1124 %1 = catchpad within %cs2 [ptr null, i32 64, ptr null]125 tail call void @exit(i32 0) #2 [ "funclet"(token %1) ]126 unreachable127 128try.cont: ; preds = %entry129 br i1 %V, label %exit_one, label %exit_two130 131exit_one:132 tail call void @g()133 call void @llvm.trap()134 unreachable135 136exit_two:137 tail call void @g()138 call void @llvm.trap()139 unreachable140}141 142; CHECK-LABEL: test3:143 144; The entry funclet contains %entry and %try.cont145; CHECK: # %entry146; CHECK: # %try.cont147; CHECK: callq g148; CHECK-NOT: # exit_one149; CHECK-NOT: # exit_two150; CHECK: ud2151 152; The catch(...) funclet contains %catch.2153; CHECK: # %catch.2{{$}}154; CHECK: callq exit155; CHECK-NEXT: int3156 157; The catch(int) funclet contains %catch158; CHECK: # %catch{{$}}159; CHECK: callq exit160; CHECK-NEXT: int3161 162declare void @exit(i32) noreturn nounwind163declare void @_CxxThrowException(ptr, ptr)164declare i32 @__CxxFrameHandler3(...)165