David Majnemer | 0ad363e | 2015-08-18 19:07:12 +0000 | [diff] [blame] | 1 | ; RUN: opt -mtriple=i686-pc-windows-msvc -S -x86-winehstate < %s | FileCheck %s |
| 2 | |
| 3 | target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32" |
| 4 | target triple = "i686-pc-windows-msvc" |
| 5 | |
| 6 | %rtti.TypeDescriptor2 = type { i8**, i8*, [3 x i8] } |
| 7 | %eh.CatchableType = type { i32, i8*, i32, i32, i32, i32, i8* } |
| 8 | %eh.CatchableTypeArray.1 = type { i32, [1 x %eh.CatchableType*] } |
| 9 | %eh.ThrowInfo = type { i32, i8*, i8*, i8* } |
| 10 | |
| 11 | $"\01??_R0H@8" = comdat any |
| 12 | |
| 13 | $"_CT??_R0H@84" = comdat any |
| 14 | |
| 15 | $_CTA1H = comdat any |
| 16 | |
| 17 | $_TI1H = comdat any |
| 18 | |
| 19 | @"\01??_7type_info@@6B@" = external constant i8* |
| 20 | @"\01??_R0H@8" = linkonce_odr global %rtti.TypeDescriptor2 { i8** @"\01??_7type_info@@6B@", i8* null, [3 x i8] c".H\00" }, comdat |
| 21 | @"_CT??_R0H@84" = linkonce_odr unnamed_addr constant %eh.CatchableType { i32 1, i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0H@8" to i8*), i32 0, i32 -1, i32 0, i32 4, i8* null }, section ".xdata", comdat |
| 22 | @_CTA1H = linkonce_odr unnamed_addr constant %eh.CatchableTypeArray.1 { i32 1, [1 x %eh.CatchableType*] [%eh.CatchableType* @"_CT??_R0H@84"] }, section ".xdata", comdat |
| 23 | @_TI1H = linkonce_odr unnamed_addr constant %eh.ThrowInfo { i32 0, i8* null, i8* null, i8* bitcast (%eh.CatchableTypeArray.1* @_CTA1H to i8*) }, section ".xdata", comdat |
| 24 | |
| 25 | define i32 @main() #0 personality i32 (...)* @__CxxFrameHandler3 { |
| 26 | entry: |
| 27 | %tmp = alloca i32, align 4 |
| 28 | ; CHECK: entry: |
| 29 | ; CHECK: store i32 -1 |
| 30 | ; CHECK: call void @g(i32 3) |
| 31 | call void @g(i32 3) |
| 32 | store i32 0, i32* %tmp, align 4 |
| 33 | %0 = bitcast i32* %tmp to i8* |
| 34 | ; CHECK: store i32 0 |
| 35 | ; CHECK: invoke void @_CxxThrowException( |
| 36 | invoke void @_CxxThrowException(i8* %0, %eh.ThrowInfo* nonnull @_TI1H) #1 |
| 37 | to label %unreachable.for.entry unwind label %catch.dispatch |
| 38 | |
| 39 | catch.dispatch: ; preds = %entry |
David Majnemer | 8a1c45d | 2015-12-12 05:38:55 +0000 | [diff] [blame] | 40 | %cs1 = catchswitch within none [label %catch] unwind to caller |
David Majnemer | 0ad363e | 2015-08-18 19:07:12 +0000 | [diff] [blame] | 41 | |
| 42 | catch: ; preds = %catch.dispatch |
David Majnemer | 8a1c45d | 2015-12-12 05:38:55 +0000 | [diff] [blame] | 43 | %1 = catchpad within %cs1 [i8* null, i32 u0x40, i8* null] |
David Majnemer | 0ad363e | 2015-08-18 19:07:12 +0000 | [diff] [blame] | 44 | ; CHECK: catch: |
| 45 | ; CHECK: store i32 2 |
| 46 | ; CHECK: invoke void @_CxxThrowException( |
| 47 | invoke void @_CxxThrowException(i8* null, %eh.ThrowInfo* null) #1 |
| 48 | to label %unreachable unwind label %catch.dispatch.1 |
| 49 | |
| 50 | catch.dispatch.1: ; preds = %catch |
David Majnemer | 8a1c45d | 2015-12-12 05:38:55 +0000 | [diff] [blame] | 51 | %cs2 = catchswitch within %1 [label %catch.3] unwind to caller |
David Majnemer | 0ad363e | 2015-08-18 19:07:12 +0000 | [diff] [blame] | 52 | catch.3: ; preds = %catch.dispatch.1 |
David Majnemer | 8a1c45d | 2015-12-12 05:38:55 +0000 | [diff] [blame] | 53 | %2 = catchpad within %cs2 [i8* null, i32 u0x40, i8* null] |
David Majnemer | 0ad363e | 2015-08-18 19:07:12 +0000 | [diff] [blame] | 54 | ; CHECK: catch.3: |
| 55 | ; CHECK: store i32 3 |
David Majnemer | 8a1c45d | 2015-12-12 05:38:55 +0000 | [diff] [blame] | 56 | ; CHECK: call void @g(i32 1) |
| 57 | call void @g(i32 1) |
| 58 | catchret from %2 to label %try.cont |
David Majnemer | 0ad363e | 2015-08-18 19:07:12 +0000 | [diff] [blame] | 59 | |
David Majnemer | 8a1c45d | 2015-12-12 05:38:55 +0000 | [diff] [blame] | 60 | try.cont: ; preds = %catch.3 |
David Majnemer | 0ad363e | 2015-08-18 19:07:12 +0000 | [diff] [blame] | 61 | ; CHECK: try.cont: |
| 62 | ; CHECK: store i32 1 |
David Majnemer | 8a1c45d | 2015-12-12 05:38:55 +0000 | [diff] [blame] | 63 | ; CHECK: call void @g(i32 2) |
| 64 | call void @g(i32 2) |
David Majnemer | 0ad363e | 2015-08-18 19:07:12 +0000 | [diff] [blame] | 65 | unreachable |
| 66 | |
David Majnemer | 0ad363e | 2015-08-18 19:07:12 +0000 | [diff] [blame] | 67 | unreachable: ; preds = %catch |
| 68 | unreachable |
| 69 | |
| 70 | unreachable.for.entry: ; preds = %entry |
| 71 | unreachable |
| 72 | } |
| 73 | |
Reid Kleckner | 84ebff4 | 2015-09-16 17:19:44 +0000 | [diff] [blame] | 74 | define i32 @nopads() #0 personality i32 (...)* @__CxxFrameHandler3 { |
| 75 | ret i32 0 |
| 76 | } |
| 77 | |
| 78 | ; CHECK-LABEL: define i32 @nopads() |
| 79 | ; CHECK-NEXT: ret i32 0 |
| 80 | ; CHECK-NOT: __ehhandler$nopads |
| 81 | |
David Majnemer | c640f86 | 2015-12-23 03:59:04 +0000 | [diff] [blame^] | 82 | ; CHECK-LABEL: define void @PR25926() |
| 83 | define void @PR25926() personality i32 (...)* @__CxxFrameHandler3 { |
| 84 | entry: |
| 85 | ; CHECK: entry: |
| 86 | ; CHECK: store i32 -1 |
| 87 | ; CHECK: store i32 0 |
| 88 | ; CHECK: invoke void @_CxxThrowException( |
| 89 | invoke void @_CxxThrowException(i8* null, %eh.ThrowInfo* null) |
| 90 | to label %unreachable unwind label %catch.dispatch |
| 91 | |
| 92 | catch.dispatch: ; preds = %entry |
| 93 | %0 = catchswitch within none [label %catch] unwind to caller |
| 94 | |
| 95 | catch: ; preds = %catch.dispatch |
| 96 | %1 = catchpad within %0 [i8* null, i32 64, i8* null] |
| 97 | ; CHECK: catch: |
| 98 | ; CHECK: store i32 3 |
| 99 | ; CHECK: invoke void @_CxxThrowException( |
| 100 | invoke void @_CxxThrowException(i8* null, %eh.ThrowInfo* null) [ "funclet"(token %1) ] |
| 101 | to label %unreachable1 unwind label %catch.dispatch1 |
| 102 | |
| 103 | catch.dispatch1: ; preds = %catch |
| 104 | %2 = catchswitch within %1 [label %catch2] unwind label %ehcleanup |
| 105 | |
| 106 | catch2: ; preds = %catch.dispatch1 |
| 107 | %3 = catchpad within %2 [i8* null, i32 64, i8* null] |
| 108 | catchret from %3 to label %try.cont |
| 109 | |
| 110 | try.cont: ; preds = %catch2 |
| 111 | ; CHECK: try.cont: |
| 112 | ; CHECK: store i32 1 |
| 113 | ; CHECK: call void @dtor() |
| 114 | call void @dtor() #3 [ "funclet"(token %1) ] |
| 115 | catchret from %1 to label %try.cont4 |
| 116 | |
| 117 | try.cont4: ; preds = %try.cont |
| 118 | ret void |
| 119 | |
| 120 | ehcleanup: ; preds = %catch.dispatch1 |
| 121 | %4 = cleanuppad within %1 [] |
| 122 | ; CHECK: ehcleanup: |
| 123 | ; CHECK: store i32 -1 |
| 124 | ; CHECK: call void @dtor() |
| 125 | call void @dtor() #3 [ "funclet"(token %4) ] |
| 126 | cleanupret from %4 unwind to caller |
| 127 | |
| 128 | unreachable: ; preds = %entry |
| 129 | unreachable |
| 130 | |
| 131 | unreachable1: ; preds = %catch |
| 132 | unreachable |
| 133 | } |
| 134 | |
David Majnemer | 0ad363e | 2015-08-18 19:07:12 +0000 | [diff] [blame] | 135 | declare void @g(i32) #0 |
| 136 | |
David Majnemer | c640f86 | 2015-12-23 03:59:04 +0000 | [diff] [blame^] | 137 | declare void @dtor() |
| 138 | |
David Majnemer | 0ad363e | 2015-08-18 19:07:12 +0000 | [diff] [blame] | 139 | declare x86_stdcallcc void @_CxxThrowException(i8*, %eh.ThrowInfo*) |
| 140 | |
| 141 | declare i32 @__CxxFrameHandler3(...) |
| 142 | |
| 143 | attributes #0 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } |
| 144 | attributes #1 = { noreturn } |
| 145 | |
| 146 | !llvm.ident = !{!0} |
| 147 | |
| 148 | !0 = !{!"clang version 3.8.0 (trunk 245153) (llvm/trunk 245238)"} |