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 personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
35 %.i8 = call i8* @llvm.framerecover(i8* bitcast (void ()* @"\01?f@@YAXXZ" to i8*), i8* %1, i32 0)
36 %bc2 = bitcast i8* %.i8 to i32**
37 %bc3 = bitcast i32** %bc2 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 %lp4 = landingpad { i8*, i32 }
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*), i32 1, i8* (i8*, i8*)* @"\01?f@@YAXXZ.catch1")
49 indirectbr i8* %recover, [label %invoke.cont2]
52 ; CHECK-LABEL: "?f@@YAXXZ.catch":
53 ; No code should be generated for the indirectbr.
55 ; CHECK: .seh_handlerdata
56 ; CHECK: .long ("$cppxdata$?f@@YAXXZ")@IMGREL
59 define internal i8* @"\01?f@@YAXXZ.catch1"(i8*, i8*) #4 personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
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 }
73 %recover = call i8* (...) @llvm.eh.actions()
77 ; CHECK-LABEL: "?f@@YAXXZ.catch1":
78 ; No code should be generated for the indirectbr.
80 ; CHECK: ".L?f@@YAXXZ.catch1$parent_frame_offset" = 16
81 ; CHECK: movq %rdx, 16(%rsp)
82 ; CHECK: .seh_handlerdata
83 ; CHECK: .long ("$cppxdata$?f@@YAXXZ")@IMGREL
85 define void @"\01?f@@YAXXZ"() #0 personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
87 %exn.slot = alloca i8*
88 %ehselector.slot = alloca i32
89 %0 = alloca i32*, align 8
90 %1 = alloca double, align 8
91 call void (...) @llvm.frameescape(i32** %0, double* %1)
92 invoke void @"\01?may_throw@@YAXXZ"()
93 to label %invoke.cont unwind label %lpad2
95 invoke.cont: ; preds = %entry
98 lpad2: ; preds = %entry
99 %2 = landingpad { i8*, i32 }
100 catch %eh.CatchHandlerType* @llvm.eh.handlertype.H.8
101 catch %eh.CatchHandlerType* @llvm.eh.handlertype.N.0
102 %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*), i32 1, i8* (i8*, i8*)* @"\01?f@@YAXXZ.catch1")
103 indirectbr i8* %recover, [label %try.cont, label %try.cont8]
105 try.cont: ; preds = %lpad2, %invoke.cont
106 invoke void @"\01?may_throw@@YAXXZ"()
107 to label %try.cont8 unwind label %lpad1
110 %3 = landingpad { i8*, i32 }
111 catch %eh.CatchHandlerType* @llvm.eh.handlertype.N.0
112 %recover2 = call i8* (...) @llvm.eh.actions(i32 1, i8* bitcast (%eh.CatchHandlerType* @llvm.eh.handlertype.N.0 to i8*), i32 1, i8* (i8*, i8*)* @"\01?f@@YAXXZ.catch1")
113 indirectbr i8* %recover2, [label %try.cont8]
115 try.cont8: ; preds = %lpad2, %try.cont
119 ; CHECK-LABEL: "?f@@YAXXZ":
120 ; No code should be generated for the indirectbr.
122 ; CHECK: .seh_handlerdata
123 ; CHECK-NEXT: .long ("$cppxdata$?f@@YAXXZ")@IMGREL
124 ; CHECK-NEXT:"$cppxdata$?f@@YAXXZ":
125 ; CHECK-NEXT: .long 429065506
126 ; CHECK-NEXT: .long 4
127 ; CHECK-NEXT: .long ("$stateUnwindMap$?f@@YAXXZ")@IMGREL
128 ; CHECK-NEXT: .long 2
129 ; CHECK-NEXT: .long ("$tryMap$?f@@YAXXZ")@IMGREL
130 ; CHECK-NEXT: .long 6
131 ; CHECK-NEXT: .long ("$ip2state$?f@@YAXXZ")@IMGREL
132 ; CHECK-NEXT: .long 32
133 ; CHECK-NEXT: .long 0
134 ; CHECK-NEXT: .long 1
135 ; CHECK-NEXT:"$stateUnwindMap$?f@@YAXXZ":
136 ; CHECK-NEXT: .long -1
137 ; CHECK-NEXT: .long 0
138 ; CHECK-NEXT: .long 0
139 ; CHECK-NEXT: .long 0
140 ; CHECK-NEXT: .long 0
141 ; CHECK-NEXT: .long 0
142 ; CHECK-NEXT: .long -1
143 ; CHECK-NEXT: .long 0
144 ; CHECK-NEXT:"$tryMap$?f@@YAXXZ":
145 ; CHECK-NEXT: .long 1
146 ; CHECK-NEXT: .long 1
147 ; CHECK-NEXT: .long 2
148 ; CHECK-NEXT: .long 1
149 ; CHECK-NEXT: .long ("$handlerMap$0$?f@@YAXXZ")@IMGREL
150 ; CHECK-NEXT: .long 0
151 ; CHECK-NEXT: .long 2
152 ; CHECK-NEXT: .long 3
153 ; CHECK-NEXT: .long 1
154 ; CHECK-NEXT: .long ("$handlerMap$1$?f@@YAXXZ")@IMGREL
155 ; CHECK-NEXT:"$handlerMap$0$?f@@YAXXZ":
156 ; CHECK-NEXT: .long 8
157 ; CHECK-NEXT: .long "??_R0H@8"@IMGREL
158 ; CHECK-NEXT: .long ".L?f@@YAXXZ$frame_escape_0"
159 ; CHECK-NEXT: .long "?f@@YAXXZ.catch"@IMGREL
160 ; CHECK-NEXT: .long ".L?f@@YAXXZ.catch$parent_frame_offset"
161 ; CHECK-NEXT:"$handlerMap$1$?f@@YAXXZ":
162 ; CHECK-NEXT: .long 0
163 ; CHECK-NEXT: .long "??_R0N@8"@IMGREL
164 ; CHECK-NEXT: .long ".L?f@@YAXXZ$frame_escape_1"
165 ; CHECK-NEXT: .long "?f@@YAXXZ.catch1"@IMGREL
166 ; CHECK-NEXT: .long ".L?f@@YAXXZ.catch1$parent_frame_offset"
167 ; CHECK-NEXT:"$ip2state$?f@@YAXXZ":
168 ; CHECK-NEXT: .long .Lfunc_begin0@IMGREL
169 ; CHECK-NEXT: .long 2
170 ; CHECK-NEXT: .long .Ltmp0@IMGREL
171 ; CHECK-NEXT: .long 0
172 ; CHECK-NEXT: .long .Lfunc_begin1@IMGREL
173 ; CHECK-NEXT: .long 3
174 ; CHECK-NEXT: .long .Lfunc_begin2@IMGREL
175 ; CHECK-NEXT: .long -1
176 ; CHECK-NEXT: .long .Ltmp13@IMGREL
177 ; CHECK-NEXT: .long 1
178 ; CHECK-NEXT: .long .Ltmp16@IMGREL
179 ; CHECK-NEXT: .long 0
182 declare void @"\01?may_throw@@YAXXZ"() #1
184 declare i32 @__CxxFrameHandler3(...)
186 ; Function Attrs: nounwind readnone
187 declare i32 @llvm.eh.typeid.for(i8*) #2
189 ; Function Attrs: nounwind
190 declare void @llvm.eh.begincatch(i8* nocapture, i8* nocapture) #3
192 ; Function Attrs: nounwind
193 declare void @llvm.eh.endcatch() #3
195 ; Function Attrs: nounwind
196 declare i8* @llvm.eh.actions(...) #3
198 ; Function Attrs: nounwind
199 declare void @llvm.frameescape(...) #3
201 ; Function Attrs: nounwind readnone
202 declare i8* @llvm.framerecover(i8*, i8*, i32) #2
204 declare void @llvm.donothing()
206 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" }
207 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" }
208 attributes #2 = { nounwind readnone }
209 attributes #3 = { nounwind }
210 attributes #4 = { "wineh-parent"="
\ 1?f@@YAXXZ" }