291 lines · plain
1; RUN: llc -verify-machineinstrs < %s | FileCheck %s2 3; CHECK-LABEL: "$cppxdata$?crash@@YAXH@Z":4; CHECK: .long "$stateUnwindMap$?crash@@YAXH@Z"5; CHECK: .long "$tryMap$?crash@@YAXH@Z"@IMGREL # TryBlockMap6; CHECK-NEXT: .long 6 # IPMapEntries7; CHECK-NEXT: .long "$ip2state$?crash@@YAXH@Z"8 9; CHECK-LABEL: "$stateUnwindMap$?crash@@YAXH@Z":10; CHECK-NEXT: .long -111; CHECK-NEXT: .long 012; CHECK-NEXT: .long 013; CHECK-NEXT: .long "?dtor$14; CHECK-NEXT: .long -115; CHECK-NEXT: .long 016 17; CHECK-LABEL: "$tryMap$?crash@@YAXH@Z":18; CHECK-NEXT: .long 019; CHECK-NEXT: .long 120; CHECK-NEXT: .long 221; CHECK-NEXT: .long 122; CHECK-NEXT: .long "$handlerMap$23 24; CHECK: "$handlerMap$0$?crash@@YAXH@Z"25; CHECK-NEXT: .long 026; CHECK-NEXT: .long 027; CHECK-NEXT: .long 028; CHECK-NEXT: .long "?catch$29 30; CHECK-LABEL: "$ip2state$?crash@@YAXH@Z":31; CHECK-NEXT: .long .Lfunc_begin0@IMGREL32; CHECK-NEXT: .long -133; CHECK-NEXT: .long .Ltmp34; CHECK-NEXT: .long 035; CHECK-NEXT: .long .Ltmp36; CHECK-NEXT: .long 137; CHECK-NEXT: .long .Ltmp38; CHECK-NEXT: .long 039; CHECK-NEXT: .long .Ltmp40; CHECK-NEXT: .long -141; CHECK-NEXT: .long "?catch$42; CHECK-NEXT: .long 243 44; ModuleID = 'windows-seh-EHa-CppCatchDotDotDot.cpp'45source_filename = "windows-seh-EHa-CppCatchDotDotDot.cpp"46target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"47target triple = "x86_64-unknown-windows-msvc"48 49%rtti.TypeDescriptor2 = type { ptr, ptr, [3 x i8] }50%eh.CatchableType = type { i32, i32, i32, i32, i32, i32, i32 }51%eh.CatchableTypeArray.1 = type { i32, [1 x i32] }52%eh.ThrowInfo = type { i32, i32, i32, i32 }53%struct.A = type { i8 }54 55$"??_C@_0BJ@EIKFKKLB@?5in?5catch?$CI?4?4?4?$CJ?5funclet?5?6?$AA@" = comdat any56 57$"??_R0H@8" = comdat any58 59$"_CT??_R0H@84" = comdat any60 61$_CTA1H = comdat any62 63$_TI1H = comdat any64 65$"??_C@_0CN@MKCAOFNA@?5Test?5CPP?5unwind?3?5in?5except?5hand@" = comdat any66 67$"??_C@_0N@LJHFFAKD@?5in?5A?5ctor?5?6?$AA@" = comdat any68 69$"??_C@_0N@HMNCGOCN@?5in?5A?5dtor?5?6?$AA@" = comdat any70 71@"?pt1@@3PEAHEA" = dso_local global ptr null, align 872@"?pt2@@3PEAHEA" = dso_local global ptr null, align 873@"?pt3@@3PEAHEA" = dso_local global ptr null, align 874@"?g@@3HA" = dso_local global i32 0, align 475@"??_C@_0BJ@EIKFKKLB@?5in?5catch?$CI?4?4?4?$CJ?5funclet?5?6?$AA@" = linkonce_odr dso_local unnamed_addr constant [25 x i8] c" in catch(...) funclet \0A\00", comdat, align 176@"??_7type_info@@6B@" = external constant ptr77@"??_R0H@8" = linkonce_odr global %rtti.TypeDescriptor2 { ptr @"??_7type_info@@6B@", ptr null, [3 x i8] c".H\00" }, comdat78@__ImageBase = external dso_local constant i879@"_CT??_R0H@84" = linkonce_odr unnamed_addr constant %eh.CatchableType { i32 1, i32 trunc (i64 sub nuw nsw (i64 ptrtoint (ptr @"??_R0H@8" to i64), i64 ptrtoint (ptr @__ImageBase to i64)) to i32), i32 0, i32 -1, i32 0, i32 4, i32 0 }, section ".xdata", comdat80@_CTA1H = linkonce_odr unnamed_addr constant %eh.CatchableTypeArray.1 { i32 1, [1 x i32] [i32 trunc (i64 sub nuw nsw (i64 ptrtoint (ptr @"_CT??_R0H@84" to i64), i64 ptrtoint (ptr @__ImageBase to i64)) to i32)] }, section ".xdata", comdat81@_TI1H = linkonce_odr unnamed_addr constant %eh.ThrowInfo { i32 0, i32 0, i32 0, i32 trunc (i64 sub nuw nsw (i64 ptrtoint (ptr @_CTA1H to i64), i64 ptrtoint (ptr @__ImageBase to i64)) to i32) }, section ".xdata", comdat82@"??_C@_0CN@MKCAOFNA@?5Test?5CPP?5unwind?3?5in?5except?5hand@" = linkonce_odr dso_local unnamed_addr constant [45 x i8] c" Test CPP unwind: in except handler i = %d \0A\00", comdat, align 183@"??_C@_0N@LJHFFAKD@?5in?5A?5ctor?5?6?$AA@" = linkonce_odr dso_local unnamed_addr constant [13 x i8] c" in A ctor \0A\00", comdat, align 184@"??_C@_0N@HMNCGOCN@?5in?5A?5dtor?5?6?$AA@" = linkonce_odr dso_local unnamed_addr constant [13 x i8] c" in A dtor \0A\00", comdat, align 185 86; Function Attrs: noinline nounwind optnone87define dso_local void @"?foo@@YAXXZ"() #0 {88entry:89 store volatile i32 0, ptr inttoptr (i64 17 to ptr), align 490 ret void91}92 93; Function Attrs: noinline optnone94define dso_local void @"?crash@@YAXH@Z"(i32 %i) #1 personality ptr @__CxxFrameHandler3 {95entry:96 %i.addr = alloca i32, align 497 %ObjA = alloca %struct.A, align 198 %tmp = alloca i32, align 499 store i32 %i, ptr %i.addr, align 4100 %0 = load i32, ptr %i.addr, align 4101 store i32 %0, ptr @"?g@@3HA", align 4102 invoke void @llvm.seh.try.begin()103 to label %invoke.cont unwind label %catch.dispatch104 105invoke.cont: ; preds = %entry106 %call = invoke ptr @"??0A@?1??crash@@YAXH@Z@QEAA@XZ"(ptr %ObjA)107 to label %invoke.cont1 unwind label %catch.dispatch108 109invoke.cont1: ; preds = %invoke.cont110 invoke void @llvm.seh.scope.begin()111 to label %invoke.cont2 unwind label %ehcleanup112 113invoke.cont2: ; preds = %invoke.cont1114 %1 = load i32, ptr %i.addr, align 4115 %cmp = icmp eq i32 %1, 1116 br i1 %cmp, label %if.then, label %if.end117 118if.then: ; preds = %invoke.cont2119 store volatile i32 0, ptr inttoptr (i64 17 to ptr), align 4120 br label %if.end121 122if.end: ; preds = %if.then, %invoke.cont2123 invoke void @llvm.seh.scope.end()124 to label %invoke.cont3 unwind label %ehcleanup125 126invoke.cont3: ; preds = %if.end127 call void @"??1A@?1??crash@@YAXH@Z@QEAA@XZ"(ptr %ObjA) #6128 br label %try.cont129 130ehcleanup: ; preds = %if.end, %invoke.cont1131 %2 = cleanuppad within none []132 call void @"??1A@?1??crash@@YAXH@Z@QEAA@XZ"(ptr %ObjA) #6 [ "funclet"(token %2) ]133 cleanupret from %2 unwind label %catch.dispatch134 135catch.dispatch: ; preds = %ehcleanup, %invoke.cont, %entry136 %3 = catchswitch within none [label %catch] unwind to caller137 138catch: ; preds = %catch.dispatch139 %4 = catchpad within %3 [ptr null, i32 0, ptr null]140 call void (...) @"?printf@@YAXZZ"(ptr @"??_C@_0BJ@EIKFKKLB@?5in?5catch?$CI?4?4?4?$CJ?5funclet?5?6?$AA@") [ "funclet"(token %4) ]141 %5 = load i32, ptr %i.addr, align 4142 %cmp4 = icmp eq i32 %5, 1143 br i1 %cmp4, label %if.then5, label %if.end6144 145if.then5: ; preds = %catch146 %6 = load i32, ptr %i.addr, align 4147 store i32 %6, ptr %tmp, align 4148 %7 = bitcast ptr %tmp to ptr149 call void @_CxxThrowException(ptr %7, ptr @_TI1H) #7 [ "funclet"(token %4) ]150 unreachable151 152if.end6: ; preds = %catch153 catchret from %4 to label %catchret.dest154 155catchret.dest: ; preds = %if.end6156 br label %try.cont157 158try.cont: ; preds = %catchret.dest, %invoke.cont3159 ret void160}161 162; Function Attrs: nounwind willreturn163declare dso_local void @llvm.seh.try.begin() #2164 165declare dso_local i32 @__CxxFrameHandler3(...)166 167; Function Attrs: noinline optnone168define internal ptr @"??0A@?1??crash@@YAXH@Z@QEAA@XZ"(ptr returned %this) unnamed_addr #1 align 2 {169entry:170 %retval = alloca ptr, align 8171 %this.addr = alloca ptr, align 8172 store ptr %this, ptr %this.addr, align 8173 %this1 = load ptr, ptr %this.addr, align 8174 store ptr %this1, ptr %retval, align 8175 call void (...) @"?printf@@YAXZZ"(ptr @"??_C@_0N@LJHFFAKD@?5in?5A?5ctor?5?6?$AA@")176 %0 = load i32, ptr @"?g@@3HA", align 4177 %cmp = icmp eq i32 %0, 0178 br i1 %cmp, label %if.then, label %if.end179 180if.then: ; preds = %entry181 store volatile i32 0, ptr inttoptr (i64 17 to ptr), align 4182 br label %if.end183 184if.end: ; preds = %if.then, %entry185 %1 = load ptr, ptr %retval, align 8186 ret ptr %1187}188 189; Function Attrs: nounwind readnone190declare dso_local void @llvm.seh.scope.begin() #3191 192; Function Attrs: nounwind readnone193declare dso_local void @llvm.seh.scope.end() #3194 195; Function Attrs: noinline nounwind optnone196define internal void @"??1A@?1??crash@@YAXH@Z@QEAA@XZ"(ptr %this) unnamed_addr #0 align 2 {197entry:198 %this.addr = alloca ptr, align 8199 store ptr %this, ptr %this.addr, align 8200 %this1 = load ptr, ptr %this.addr, align 8201 call void (...) @"?printf@@YAXZZ"(ptr @"??_C@_0N@HMNCGOCN@?5in?5A?5dtor?5?6?$AA@")202 ret void203}204 205declare dso_local void @"?printf@@YAXZZ"(...) #4206 207declare dso_local void @_CxxThrowException(ptr, ptr)208 209; Function Attrs: noinline norecurse optnone210define dso_local i32 @main() #5 personality ptr @__C_specific_handler {211entry:212 %retval = alloca i32, align 4213 %i = alloca i32, align 4214 %__exception_code = alloca i32, align 4215 store i32 0, ptr %retval, align 4216 store i32 0, ptr %i, align 4217 br label %for.cond218 219for.cond: ; preds = %for.inc, %entry220 %0 = load i32, ptr %i, align 4221 %cmp = icmp slt i32 %0, 2222 br i1 %cmp, label %for.body, label %for.end223 224for.body: ; preds = %for.cond225 invoke void @llvm.seh.try.begin()226 to label %invoke.cont unwind label %catch.dispatch227 228invoke.cont: ; preds = %for.body229 %1 = load volatile i32, ptr %i, align 4230 invoke void @"?crash@@YAXH@Z"(i32 %1) #8231 to label %invoke.cont1 unwind label %catch.dispatch232 233invoke.cont1: ; preds = %invoke.cont234 invoke void @llvm.seh.try.end()235 to label %invoke.cont2 unwind label %catch.dispatch236 237catch.dispatch: ; preds = %invoke.cont1, %invoke.cont, %for.body238 %2 = catchswitch within none [label %__except] unwind to caller239 240__except: ; preds = %catch.dispatch241 %3 = catchpad within %2 [ptr null]242 catchret from %3 to label %__except3243 244__except3: ; preds = %__except245 %4 = call i32 @llvm.eh.exceptioncode(token %3)246 store i32 %4, ptr %__exception_code, align 4247 %5 = load i32, ptr %i, align 4248 call void (...) @"?printf@@YAXZZ"(ptr @"??_C@_0CN@MKCAOFNA@?5Test?5CPP?5unwind?3?5in?5except?5hand@", i32 %5)249 br label %__try.cont250 251__try.cont: ; preds = %__except3, %invoke.cont2252 br label %for.inc253 254for.inc: ; preds = %__try.cont255 %6 = load i32, ptr %i, align 4256 %inc = add nsw i32 %6, 1257 store i32 %inc, ptr %i, align 4258 br label %for.cond259 260invoke.cont2: ; preds = %invoke.cont1261 br label %__try.cont262 263for.end: ; preds = %for.cond264 ret i32 0265}266 267declare dso_local i32 @__C_specific_handler(...)268 269; Function Attrs: nounwind willreturn270declare dso_local void @llvm.seh.try.end() #2271 272; Function Attrs: nounwind readnone273declare i32 @llvm.eh.exceptioncode(token) #3274 275attributes #0 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "use-soft-float"="false" }276attributes #1 = { noinline optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "use-soft-float"="false" }277attributes #2 = { nounwind willreturn }278attributes #3 = { nounwind readnone }279attributes #4 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "use-soft-float"="false" }280attributes #5 = { noinline norecurse optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "use-soft-float"="false" }281attributes #6 = { nounwind }282attributes #7 = { noreturn }283attributes #8 = { noinline }284 285!llvm.module.flags = !{!0, !1}286 287!0 = !{i32 1, !"wchar_size", i32 2}288!1 = !{i32 2, !"eh-asynch", i32 1}289 290 291