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 %rtti.TypeDescriptor2 = type { i8**, i8*, [3 x i8] }
5 %eh.CatchableType = type { i32, i8*, i32, i32, i32, i32, i8* }
6 %eh.CatchableTypeArray.1 = type { i32, [1 x %eh.CatchableType*] }
7 %eh.ThrowInfo = type { i32, i8*, i8*, i8* }
8 %eh.CatchHandlerType = type { i32, i8* }
10 $"\01??_R0H@8" = comdat any
12 @"\01??_7type_info@@6B@" = external constant i8*
13 @"\01??_R0H@8" = linkonce_odr global %rtti.TypeDescriptor2 { i8** @"\01??_7type_info@@6B@", i8* null, [3 x i8] c".H\00" }, comdat
15 @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"
16 @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"
19 declare void @useints(...)
20 declare void @f(i32 %p)
21 declare i32 @__CxxFrameHandler3(...)
23 define i32 @try_catch_catch() personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
25 %a = call i32 @getint()
26 %b = call i32 @getint()
27 %c = call i32 @getint()
28 %d = call i32 @getint()
29 call void (...) @useints(i32 %a, i32 %b, i32 %c, i32 %d)
31 to label %try.cont unwind label %catch.dispatch
33 catch.dispatch: ; preds = %entry
34 %0 = catchpad [%eh.CatchHandlerType* @llvm.eh.handlertype.H.0, i8* null]
35 to label %catch unwind label %catchendblock
39 to label %invoke.cont.2 unwind label %catchendblock
41 invoke.cont.2: ; preds = %catch
42 catchret %0 to label %try.cont
44 try.cont: ; preds = %entry, %invoke.cont.2, %invoke.cont.3
47 catchendblock: ; preds = %catch,
48 catchendpad unwind to caller
51 ; X86-LABEL: _try_catch_catch:
53 ; X86: movl %esp, %ebp
57 ; X86: subl ${{[0-9]+}}, %esp
63 ; X86: movl $0, -{{[0-9]+}}(%ebp)
64 ; X86: movl $1, (%esp)
66 ; X86: [[contbb:LBB0_[0-9]+]]:
67 ; X86: movl -{{[0-9]+}}(%ebp), %esp
68 ; X86: addl ${{[0-9]+}}, %esp
75 ; X86: [[catch1bb:LBB0_[0-9]+]]: # %catch{{$}}
79 ; X86: movl $1, -{{[0-9]+}}(%ebp)
80 ; X86: movl $2, (%esp)
82 ; X86: movl $[[contbb]], %eax
83 ; X86-NEXT: addl $16, %esp
87 ; X86: L__ehtable$try_catch_catch:
88 ; X86: $handlerMap$0$try_catch_catch:
90 ; X86: .long "??_R0H@8"
92 ; X86: .long [[catch1bb]]
94 ; X64-LABEL: try_catch_catch:
100 ; X64: .seh_pushreg 7
102 ; X64: .seh_pushreg 3
103 ; X64: subq $40, %rsp
104 ; X64: .seh_stackalloc 40
105 ; X64: leaq 32(%rsp), %rbp
106 ; X64: .seh_setframe 5, 32
114 ; X64: [[contbb:\.LBB0_[0-9]+]]:
115 ; X64: addq $40, %rsp
119 ; X64: [[catch1bb:\.LBB0_[0-9]+]]: # %catch{{$}}
120 ; X64: movq %rdx, 16(%rsp)
122 ; X64: movq %rdx, %rbp
123 ; X64: subq $32, %rsp
126 ; X64: leaq [[contbb]](%rip), %rax
127 ; X64: addq $32, %rsp
131 ; X64: $handlerMap$0$try_catch_catch:
133 ; X64: .long "??_R0H@8"@IMGREL
135 ; X64: .long [[catch1bb]]@IMGREL