1 ; RUN: llc -mtriple=i686-pc-windows-msvc < %s | FileCheck --check-prefix=X86 %s
2 ; RUN: llc -mtriple=x86_64-pc-windows-msvc < %s | FileCheck --check-prefix=X64 %s
4 ; Loosely based on IR for this C++ source code:
16 %rtti.TypeDescriptor2 = type { i8**, i8*, [3 x i8] }
17 %eh.CatchableType = type { i32, i8*, i32, i32, i32, i32, i8* }
18 %eh.CatchableTypeArray.1 = type { i32, [1 x %eh.CatchableType*] }
19 %eh.ThrowInfo = type { i32, i8*, i8*, i8* }
20 %eh.CatchHandlerType = type { i32, i8* }
22 $"\01??_R0H@8" = comdat any
24 @"\01??_7type_info@@6B@" = external constant i8*
25 @"\01??_R0H@8" = linkonce_odr global %rtti.TypeDescriptor2 { i8** @"\01??_7type_info@@6B@", i8* null, [3 x i8] c".H\00" }, comdat
27 @llvm.eh.handlertype.H.0 = private unnamed_addr constant %eh.CatchHandlerType { i32 0, i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0H@8" to i8*) }, section "llvm.metadata"
28 @llvm.eh.handlertype.H.1 = private unnamed_addr constant %eh.CatchHandlerType { i32 1, i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0H@8" to i8*) }, section "llvm.metadata"
30 declare void @f(i32 %p)
31 declare i32 @__CxxFrameHandler3(...)
33 define i32 @try_catch_catch() personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
36 to label %try.cont unwind label %catch.dispatch
38 catch.dispatch: ; preds = %entry
39 %0 = catchpad [%eh.CatchHandlerType* @llvm.eh.handlertype.H.0, i8* null]
40 to label %catch unwind label %catch.dispatch.2
42 catch: ; preds = %catch.dispatch
44 to label %invoke.cont.2 unwind label %catchendblock
46 invoke.cont.2: ; preds = %catch
47 catchret %0 to label %try.cont
49 catch.dispatch.2: ; preds = %catch.dispatch
50 %1 = catchpad [%eh.CatchHandlerType* @llvm.eh.handlertype.H.0, i8* null]
51 to label %catch.2 unwind label %catchendblock
53 catch.2: ; preds = %catch.dispatch.2
55 to label %invoke.cont.3 unwind label %catchendblock
57 invoke.cont.3: ; preds = %catch.2
58 catchret %1 to label %try.cont
60 try.cont: ; preds = %entry, %invoke.cont.2, %invoke.cont.3
63 catchendblock: ; preds = %catch, %catch.2, %catch.dispatch.2
64 catchendpad unwind to caller
67 ; X86-LABEL: _try_catch_catch:
68 ; X86: movl $0, -{{[0-9]+}}(%ebp)
69 ; X86: movl $1, (%esp)
71 ; X86: [[contbb:LBB0_[0-9]+]]:
72 ; X86: movl -{{[0-9]+}}(%ebp), %esp
75 ; X86: [[catch1bb:LBB0_[0-9]+]]: # %catch{{$}}
76 ; X86: movl $1, -{{[0-9]+}}(%ebp)
77 ; X86: movl $2, (%esp)
79 ; X86: movl $[[contbb]], %eax
82 ; X86: [[catch2bb:LBB0_[0-9]+]]: # %catch.2{{$}}
83 ; X86: movl $1, -{{[0-9]+}}(%ebp)
84 ; X86: movl $3, (%esp)
86 ; X86: movl $[[contbb]], %eax
89 ; X86: L__ehtable$try_catch_catch:
90 ; X86: $handlerMap$0$try_catch_catch:
92 ; X86: .long "??_R0H@8"
94 ; X86: .long [[catch1bb]]
96 ; X86: .long "??_R0H@8"
98 ; X86: .long [[catch2bb]]
100 ; X64-LABEL: try_catch_catch:
103 ; X64: [[contbb:\.LBB0_[0-9]+]]:
106 ; X64: [[catch1bb:\.LBB0_[0-9]+]]: # %catch{{$}}
109 ; X64: leaq [[contbb]](%rip), %rax
112 ; X64: [[catch2bb:\.LBB0_[0-9]+]]: # %catch.2{{$}}
115 ; X64: leaq [[contbb]](%rip), %rax
118 ; FIXME: Get rid of these parent_frame_offset things below. They are leftover
119 ; from our IR outlining strategy.
120 ; X64: $handlerMap$0$try_catch_catch:
122 ; X64: .long "??_R0H@8"@IMGREL
124 ; X64: .long [[catch1bb]]@IMGREL
125 ; X64 .long .Lcatch$parent_frame_offset
127 ; X64: .long "??_R0H@8"@IMGREL
129 ; X64: .long [[catch2bb]]@IMGREL
130 ; X64 .long .Lcatch.2$parent_frame_offset