1 ; RUN: llc < %s | FileCheck %s
3 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
4 target triple = "x86_64-pc-windows-msvc"
6 ; This test case is equivalent to:
20 %rtti.TypeDescriptor2 = type { i8**, i8*, [3 x i8] }
21 %eh.CatchHandlerType = type { i32, i8* }
23 $"\01??_R0N@8" = comdat any
25 $"\01??_R0H@8" = comdat any
27 @"\01??_7type_info@@6B@" = external constant i8*
28 @"\01??_R0N@8" = linkonce_odr global %rtti.TypeDescriptor2 { i8** @"\01??_7type_info@@6B@", i8* null, [3 x i8] c".N\00" }, comdat
29 @llvm.eh.handlertype.N.0 = private unnamed_addr constant %eh.CatchHandlerType { i32 0, i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0N@8" to i8*) }, section "llvm.metadata"
30 @"\01??_R0H@8" = linkonce_odr global %rtti.TypeDescriptor2 { i8** @"\01??_7type_info@@6B@", i8* null, [3 x i8] c".H\00" }, comdat
31 @llvm.eh.handlertype.H.8 = private unnamed_addr constant %eh.CatchHandlerType { i32 8, i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0H@8" to i8*) }, section "llvm.metadata"
33 define internal i8* @"\01?f@@YAXXZ.catch"(i8*, i8*) #4 {
35 %.i8 = call i8* @llvm.framerecover(i8* bitcast (void ()* @"\01?f@@YAXXZ" to i8*), i8* %1, i32 0)
36 %2 = bitcast i8* %.i8 to i32**
37 %3 = bitcast i32** %2 to i8*
38 invoke void @"\01?may_throw@@YAXXZ"()
39 to label %invoke.cont2 unwind label %lpad1
41 invoke.cont2: ; preds = %entry
42 ret i8* blockaddress(@"\01?f@@YAXXZ", %try.cont)
44 lpad1: ; preds = %entry
45 %4 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*)
47 catch %eh.CatchHandlerType* @llvm.eh.handlertype.N.0
48 %recover = call i8* (...)* @llvm.eh.actions(i32 1, i8* bitcast (%eh.CatchHandlerType* @llvm.eh.handlertype.N.0 to i8*), double* null, i8* (i8*, i8*)* @"\01?f@@YAXXZ.catch1")
49 indirectbr i8* %recover, [label %invoke.cont2]
52 ; CHECK-LABEL: "?f@@YAXXZ.catch":
53 ; CHECK: ".L?f@@YAXXZ.catch$parent_frame_offset" = 56
54 ; CHECK: movq %rdx, 56(%rsp)
55 ; CHECK: .seh_handlerdata
56 ; CHECK: .long ("$cppxdata$?f@@YAXXZ")@IMGREL
59 define internal i8* @"\01?f@@YAXXZ.catch1"(i8*, i8*) #4 {
61 %.i8 = call i8* @llvm.framerecover(i8* bitcast (void ()* @"\01?f@@YAXXZ" to i8*), i8* %1, i32 1)
62 %2 = bitcast i8* %.i8 to double*
63 %3 = bitcast double* %2 to i8*
64 invoke void (...)* @llvm.donothing()
65 to label %done unwind label %lpad
68 ret i8* blockaddress(@"\01?f@@YAXXZ", %try.cont8)
70 lpad: ; preds = %entry
71 %4 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*)
76 ; CHECK-LABEL: "?f@@YAXXZ.catch1":
77 ; CHECK: ".L?f@@YAXXZ.catch1$parent_frame_offset" = 16
78 ; CHECK: movq %rdx, 16(%rsp)
79 ; CHECK: .seh_handlerdata
80 ; CHECK: .long ("$cppxdata$?f@@YAXXZ")@IMGREL
82 define void @"\01?f@@YAXXZ"() #0 {
84 %unwindhelp = alloca i64
85 %exn.slot = alloca i8*
86 %ehselector.slot = alloca i32
87 %0 = alloca i32*, align 8
88 %1 = alloca double, align 8
89 call void (...)* @llvm.frameescape(i32** %0, double* %1)
90 store volatile i64 -2, i64* %unwindhelp
91 %2 = bitcast i64* %unwindhelp to i8*
92 call void @llvm.eh.unwindhelp(i8* %2)
93 invoke void @"\01?may_throw@@YAXXZ"()
94 to label %invoke.cont unwind label %lpad2
96 invoke.cont: ; preds = %entry
99 lpad2: ; preds = %entry
100 %3 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*)
101 catch %eh.CatchHandlerType* @llvm.eh.handlertype.H.8
102 catch %eh.CatchHandlerType* @llvm.eh.handlertype.N.0
103 %recover = call i8* (...)* @llvm.eh.actions(i32 1, i8* bitcast (%eh.CatchHandlerType* @llvm.eh.handlertype.H.8 to i8*), i32** %0, i8* (i8*, i8*)* @"\01?f@@YAXXZ.catch", i32 1, i8* bitcast (%eh.CatchHandlerType* @llvm.eh.handlertype.N.0 to i8*), double* %1, i8* (i8*, i8*)* @"\01?f@@YAXXZ.catch1")
104 indirectbr i8* %recover, [label %try.cont, label %try.cont8]
106 try.cont: ; preds = %lpad2, %invoke.cont
107 invoke void @"\01?may_throw@@YAXXZ"()
108 to label %try.cont8 unwind label %lpad1
111 %4 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*)
112 catch %eh.CatchHandlerType* @llvm.eh.handlertype.N.0
113 %recover2 = call i8* (...)* @llvm.eh.actions(i32 1, i8* bitcast (%eh.CatchHandlerType* @llvm.eh.handlertype.N.0 to i8*), double* null, i8* (i8*, i8*)* @"\01?f@@YAXXZ.catch1")
114 indirectbr i8* %recover2, [label %try.cont8]
116 try.cont8: ; preds = %lpad2, %try.cont
120 ; CHECK-LABEL: "?f@@YAXXZ":
121 ; CHECK: .seh_handlerdata
122 ; CHECK-NEXT: .long ("$cppxdata$?f@@YAXXZ")@IMGREL
123 ; CHECK-NEXT:"$cppxdata$?f@@YAXXZ":
124 ; CHECK-NEXT: .long 429065506
125 ; CHECK-NEXT: .long 4
126 ; CHECK-NEXT: .long ("$stateUnwindMap$?f@@YAXXZ")@IMGREL
127 ; CHECK-NEXT: .long 2
128 ; CHECK-NEXT: .long ("$tryMap$?f@@YAXXZ")@IMGREL
129 ; CHECK-NEXT: .long 3
130 ; CHECK-NEXT: .long ("$ip2state$?f@@YAXXZ")@IMGREL
131 ; CHECK-NEXT: .long 64
132 ; CHECK-NEXT: .long 0
133 ; CHECK-NEXT: .long 1
134 ; CHECK-NEXT:"$stateUnwindMap$?f@@YAXXZ":
135 ; CHECK-NEXT: .long -1
136 ; CHECK-NEXT: .long 0
137 ; CHECK-NEXT: .long 0
138 ; CHECK-NEXT: .long 0
139 ; CHECK-NEXT: .long 0
140 ; CHECK-NEXT: .long 0
141 ; CHECK-NEXT: .long -1
142 ; CHECK-NEXT: .long 0
143 ; CHECK-NEXT:"$tryMap$?f@@YAXXZ":
144 ; CHECK-NEXT: .long 1
145 ; CHECK-NEXT: .long 1
146 ; CHECK-NEXT: .long 2147483647
147 ; CHECK-NEXT: .long 1
148 ; CHECK-NEXT: .long ("$handlerMap$0$?f@@YAXXZ")@IMGREL
149 ; CHECK-NEXT: .long 0
150 ; CHECK-NEXT: .long 2
151 ; CHECK-NEXT: .long 2147483647
152 ; CHECK-NEXT: .long 1
153 ; CHECK-NEXT: .long ("$handlerMap$1$?f@@YAXXZ")@IMGREL
154 ; CHECK-NEXT:"$handlerMap$0$?f@@YAXXZ":
155 ; CHECK-NEXT: .long 8
156 ; CHECK-NEXT: .long "??_R0H@8"@IMGREL
157 ; CHECK-NEXT: .long 0
158 ; CHECK-NEXT: .long "?f@@YAXXZ.catch"@IMGREL
159 ; CHECK-NEXT: .long ".L?f@@YAXXZ.catch$parent_frame_offset"
160 ; CHECK-NEXT:"$handlerMap$1$?f@@YAXXZ":
161 ; CHECK-NEXT: .long 0
162 ; CHECK-NEXT: .long "??_R0N@8"@IMGREL
163 ; CHECK-NEXT: .long 0
164 ; CHECK-NEXT: .long "?f@@YAXXZ.catch1"@IMGREL
165 ; CHECK-NEXT: .long ".L?f@@YAXXZ.catch1$parent_frame_offset"
166 ; CHECK-NEXT:"$ip2state$?f@@YAXXZ":
167 ; CHECK-NEXT: .long .Ltmp0@IMGREL
168 ; CHECK-NEXT: .long 0
169 ; CHECK-NEXT: .long .Ltmp13@IMGREL
170 ; CHECK-NEXT: .long 1
171 ; CHECK-NEXT: .long .Ltmp16@IMGREL
172 ; CHECK-NEXT: .long 0
175 declare void @"\01?may_throw@@YAXXZ"() #1
177 declare i32 @__CxxFrameHandler3(...)
179 ; Function Attrs: nounwind readnone
180 declare i32 @llvm.eh.typeid.for(i8*) #2
182 ; Function Attrs: nounwind
183 declare void @llvm.eh.begincatch(i8* nocapture, i8* nocapture) #3
185 ; Function Attrs: nounwind
186 declare void @llvm.eh.endcatch() #3
188 ; Function Attrs: nounwind
189 declare i8* @llvm.eh.actions(...) #3
191 ; Function Attrs: nounwind
192 declare void @llvm.frameescape(...) #3
194 ; Function Attrs: nounwind readnone
195 declare i8* @llvm.framerecover(i8*, i8*, i32) #2
197 ; Function Attrs: nounwind
198 declare void @llvm.eh.unwindhelp(i8*) #3
200 declare void @llvm.donothing(...)
202 attributes #0 = { "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" "wineh-parent"="
\ 1?f@@YAXXZ" }
203 attributes #1 = { "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" }
204 attributes #2 = { nounwind readnone }
205 attributes #3 = { nounwind }
206 attributes #4 = { "wineh-parent"="
\ 1?f@@YAXXZ" }