| Reid Kleckner | f7ad534 | 2016-10-19 17:08:23 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s | FileCheck %s |
| 2 | |
| 3 | ; IR generated by the following C++ source with modifications to reuse the 'v' |
| 4 | ; alloca between catchpads: |
| 5 | ; extern "C" void maythrow(); |
| 6 | ; int main() { |
| 7 | ; try { |
| 8 | ; try { |
| 9 | ; maythrow(); |
| 10 | ; } catch (int v) { |
| 11 | ; maythrow(); |
| 12 | ; } |
| 13 | ; } catch (int v) { |
| 14 | ; maythrow(); |
| 15 | ; } |
| 16 | ; return 0; |
| 17 | ; } |
| 18 | |
| 19 | ; CHECK: $cppxdata$main: |
| 20 | ; CHECK-NEXT: .long 429065506 # MagicNumber |
| 21 | ; CHECK-NEXT: .long 4 # MaxState |
| 22 | ; CHECK-NEXT: .long ($stateUnwindMap$main)@IMGREL # UnwindMap |
| 23 | ; CHECK-NEXT: .long 2 # NumTryBlocks |
| 24 | ; CHECK-NEXT: .long ($tryMap$main)@IMGREL # TryBlockMap |
| 25 | ; CHECK-NEXT: .long 5 # IPMapEntries |
| 26 | ; CHECK-NEXT: .long ($ip2state$main)@IMGREL # IPToStateXData |
| 27 | ; CHECK-NEXT: .long 32 # UnwindHelp |
| 28 | ; CHECK-NEXT: .long 0 # ESTypeList |
| 29 | ; CHECK-NEXT: .long 1 # EHFlags |
| 30 | |
| 31 | ; CHECK: $tryMap$main: |
| 32 | ; CHECK-NEXT: .long 1 # TryLow |
| 33 | ; CHECK-NEXT: .long 1 # TryHigh |
| 34 | ; CHECK-NEXT: .long 2 # CatchHigh |
| 35 | ; CHECK-NEXT: .long 1 # NumCatches |
| 36 | ; CHECK-NEXT: .long ($handlerMap$0$main)@IMGREL # HandlerArray |
| 37 | ; CHECK-NEXT: .long 0 # TryLow |
| 38 | ; CHECK-NEXT: .long 2 # TryHigh |
| 39 | ; CHECK-NEXT: .long 3 # CatchHigh |
| 40 | ; CHECK-NEXT: .long 1 # NumCatches |
| 41 | ; CHECK-NEXT: .long ($handlerMap$1$main)@IMGREL # HandlerArray |
| 42 | |
| 43 | ; CHECK: $handlerMap$0$main: |
| 44 | ; CHECK-NEXT: .long 0 # Adjectives |
| 45 | ; CHECK-NEXT: .long "??_R0H@8"@IMGREL # Type |
| 46 | ; CHECK-NEXT: .long [[v_offset:[0-9]+]] # CatchObjOffset |
| 47 | ; CHECK-NEXT: .long "?catch$2@?0?main@4HA"@IMGREL # Handler |
| 48 | ; CHECK-NEXT: .long {{.*}} # ParentFrameOffset |
| 49 | |
| 50 | ; CHECK: $handlerMap$1$main: |
| 51 | ; CHECK-NEXT: .long 0 # Adjectives |
| 52 | ; CHECK-NEXT: .long "??_R0H@8"@IMGREL # Type |
| 53 | ; CHECK-NEXT: .long [[v_offset]] # CatchObjOffset |
| 54 | ; CHECK-NEXT: .long "?catch$4@?0?main@4HA"@IMGREL # Handler |
| 55 | ; CHECK-NEXT: .long {{.*}} # ParentFrameOffset |
| 56 | |
| 57 | ; ModuleID = 't.cpp' |
| 58 | source_filename = "t.cpp" |
| 59 | target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" |
| 60 | target triple = "x86_64-pc-windows-msvc19.0.24210" |
| 61 | |
| 62 | %rtti.TypeDescriptor2 = type { i8**, i8*, [3 x i8] } |
| 63 | |
| 64 | $"\01??_R0H@8" = comdat any |
| 65 | |
| 66 | @"\01??_7type_info@@6B@" = external constant i8* |
| 67 | @"\01??_R0H@8" = linkonce_odr global %rtti.TypeDescriptor2 { i8** @"\01??_7type_info@@6B@", i8* null, [3 x i8] c".H\00" }, comdat |
| 68 | |
| 69 | ; Function Attrs: norecurse uwtable |
| 70 | define i32 @main() local_unnamed_addr personality i32 (...)* @__CxxFrameHandler3 { |
| 71 | entry: |
| 72 | %v = alloca i32, align 4 |
| 73 | invoke void @maythrow() |
| 74 | to label %try.cont6 unwind label %catch.dispatch |
| 75 | |
| 76 | catch.dispatch: ; preds = %entry |
| 77 | %0 = catchswitch within none [label %catch] unwind label %catch.dispatch2 |
| 78 | |
| 79 | catch: ; preds = %catch.dispatch |
| 80 | %1 = catchpad within %0 [%rtti.TypeDescriptor2* @"\01??_R0H@8", i32 0, i32* %v] |
| 81 | invoke void @maythrow() [ "funclet"(token %1) ] |
| 82 | to label %invoke.cont1 unwind label %catch.dispatch2 |
| 83 | |
| 84 | catch.dispatch2: ; preds = %catch, %catch.dispatch |
| 85 | %2 = catchswitch within none [label %catch3] unwind to caller |
| 86 | |
| 87 | catch3: ; preds = %catch.dispatch2 |
| 88 | %3 = catchpad within %2 [%rtti.TypeDescriptor2* @"\01??_R0H@8", i32 0, i32* %v] |
| 89 | call void @maythrow() [ "funclet"(token %3) ] |
| 90 | catchret from %3 to label %try.cont6 |
| 91 | |
| 92 | try.cont6: ; preds = %entry, %invoke.cont1, %catch3 |
| 93 | ret i32 0 |
| 94 | |
| 95 | invoke.cont1: ; preds = %catch |
| 96 | catchret from %1 to label %try.cont6 |
| 97 | } |
| 98 | |
| 99 | declare void @maythrow() local_unnamed_addr #1 |
| 100 | |
| 101 | declare i32 @__CxxFrameHandler3(...) |
| 102 | |
| 103 | !llvm.module.flags = !{!0} |
| 104 | !llvm.ident = !{!1} |
| 105 | |
| 106 | !0 = !{i32 1, !"PIC Level", i32 2} |
| 107 | !1 = !{!"clang version 4.0.0 "} |