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 %rtti.TypeDescriptor2 = type { i8**, i8*, [3 x i8] }
7 %eh.CatchableType = type { i32, i32, i32, i32, i32, i32, i32 }
8 %eh.CatchableTypeArray.1 = type { i32, [1 x i32] }
9 %eh.ThrowInfo = type { i32, i32, i32, i32 }
10 %struct.S = type { i8 }
12 $"\01??_DS@@QEAA@XZ" = comdat any
14 $"\01??_R0H@8" = comdat any
16 $"_CT??_R0H@84" = comdat any
22 @"\01??_7type_info@@6B@" = external constant i8*
23 @"\01??_R0H@8" = linkonce_odr global %rtti.TypeDescriptor2 { i8** @"\01??_7type_info@@6B@", i8* null, [3 x i8] c".H\00" }, comdat
24 @__ImageBase = external constant i8
25 @"_CT??_R0H@84" = linkonce_odr unnamed_addr constant %eh.CatchableType { i32 1, i32 trunc (i64 sub nuw nsw (i64 ptrtoint (%rtti.TypeDescriptor2* @"\01??_R0H@8" to i64), i64 ptrtoint (i8* @__ImageBase to i64)) to i32), i32 0, i32 -1, i32 0, i32 4, i32 0 }, section ".xdata", comdat
26 @_CTA1H = linkonce_odr unnamed_addr constant %eh.CatchableTypeArray.1 { i32 1, [1 x i32] [i32 trunc (i64 sub nuw nsw (i64 ptrtoint (%eh.CatchableType* @"_CT??_R0H@84" to i64), i64 ptrtoint (i8* @__ImageBase to i64)) to i32)] }, section ".xdata", comdat
27 @_TI1H = linkonce_odr unnamed_addr constant %eh.ThrowInfo { i32 0, i32 0, i32 0, i32 trunc (i64 sub nuw nsw (i64 ptrtoint (%eh.CatchableTypeArray.1* @_CTA1H to i64), i64 ptrtoint (i8* @__ImageBase to i64)) to i32) }, section ".xdata", comdat
30 ; CHECK-LABEL: "?test1@@YAXXZ":
31 ; CHECK: .seh_handlerdata
32 ; CHECK-NEXT: .long ("$cppxdata$?test1@@YAXXZ")@IMGREL
33 ; CHECK-NEXT: .align 4
34 ; CHECK-NEXT:"$cppxdata$?test1@@YAXXZ":
35 ; CHECK-NEXT: .long 429065506
37 ; CHECK-NEXT: .long ("$stateUnwindMap$?test1@@YAXXZ")@IMGREL
41 ; CHECK-NEXT: .long ("$ip2state$?test1@@YAXXZ")@IMGREL
42 ; CHECK-NEXT: .long 32
45 ; CHECK-NEXT:"$stateUnwindMap$?test1@@YAXXZ":
46 ; CHECK-NEXT: .long -1
47 ; CHECK-NEXT: .long "?test1@@YAXXZ.cleanup"@IMGREL
48 ; CHECK-NEXT:"$ip2state$?test1@@YAXXZ":
49 ; CHECK-NEXT: .long .Lfunc_begin0@IMGREL
50 ; CHECK-NEXT: .long -1
51 ; CHECK-NEXT: .long .Ltmp0@IMGREL
54 define void @"\01?test1@@YAXXZ"() #0 personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
56 %unwindhelp = alloca i64
57 %tmp = alloca i32, align 4
58 %exn.slot = alloca i8*
59 %ehselector.slot = alloca i32
60 store i32 0, i32* %tmp
61 %0 = bitcast i32* %tmp to i8*
62 call void (...) @llvm.localescape()
63 store volatile i64 -2, i64* %unwindhelp
64 %1 = bitcast i64* %unwindhelp to i8*
65 call void @llvm.eh.unwindhelp(i8* %1)
66 invoke void @_CxxThrowException(i8* %0, %eh.ThrowInfo* @_TI1H) #8
67 to label %unreachable unwind label %lpad1
69 lpad1: ; preds = %entry
70 %2 = landingpad { i8*, i32 }
72 %recover = call i8* (...) @llvm.eh.actions(i32 0, void (i8*, i8*)* @"\01?test1@@YAXXZ.cleanup")
73 indirectbr i8* %recover, []
75 unreachable: ; preds = %entry
79 declare void @_CxxThrowException(i8*, %eh.ThrowInfo*)
81 declare i32 @__CxxFrameHandler3(...)
83 ; Function Attrs: nounwind
84 define linkonce_odr void @"\01??_DS@@QEAA@XZ"(%struct.S* %this) unnamed_addr #1 comdat align 2 {
86 %this.addr = alloca %struct.S*, align 8
87 store %struct.S* %this, %struct.S** %this.addr, align 8
88 %this1 = load %struct.S*, %struct.S** %this.addr
89 call void @"\01??1S@@QEAA@XZ"(%struct.S* %this1) #4
93 ; CHECK-LABEL: "?test2@@YAX_N@Z":
94 ; CHECK: .seh_handlerdata
95 ; CHECK-NEXT: .long ("$cppxdata$?test2@@YAX_N@Z")@IMGREL
96 ; CHECK-NEXT: .align 4
97 ; CHECK-NEXT:"$cppxdata$?test2@@YAX_N@Z":
98 ; CHECK-NEXT: .long 429065506
100 ; CHECK-NEXT: .long ("$stateUnwindMap$?test2@@YAX_N@Z")@IMGREL
101 ; CHECK-NEXT: .long 0
102 ; CHECK-NEXT: .long 0
103 ; CHECK-NEXT: .long 4
104 ; CHECK-NEXT: .long ("$ip2state$?test2@@YAX_N@Z")@IMGREL
105 ; CHECK-NEXT: .long 40
106 ; CHECK-NEXT: .long 0
107 ; CHECK-NEXT: .long 1
108 ; CHECK-NEXT:"$stateUnwindMap$?test2@@YAX_N@Z":
109 ; CHECK-NEXT: .long -1
110 ; CHECK-NEXT: .long "?test2@@YAX_N@Z.cleanup"@IMGREL
111 ; CHECK-NEXT: .long 0
112 ; CHECK-NEXT: .long "?test2@@YAX_N@Z.cleanup1"@IMGREL
113 ; CHECK-NEXT:"$ip2state$?test2@@YAX_N@Z":
114 ; CHECK-NEXT: .long .Lfunc_begin1@IMGREL
115 ; CHECK-NEXT: .long -1
116 ; CHECK-NEXT: .long .Ltmp7@IMGREL
117 ; CHECK-NEXT: .long 0
118 ; CHECK-NEXT: .long .Ltmp9@IMGREL
119 ; CHECK-NEXT: .long 1
120 ; CHECK-NEXT: .long .Ltmp12@IMGREL
121 ; CHECK-NEXT: .long 0
123 define void @"\01?test2@@YAX_N@Z"(i1 zeroext %b) #2 personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
124 %b.addr = alloca i8, align 1
125 %s = alloca %struct.S, align 1
126 %exn.slot = alloca i8*
127 %ehselector.slot = alloca i32
128 %s1 = alloca %struct.S, align 1
129 %frombool = zext i1 %b to i8
130 store i8 %frombool, i8* %b.addr, align 1
131 call void (...) @llvm.localescape(%struct.S* %s, %struct.S* %s1)
132 call void @"\01?may_throw@@YAXXZ"()
133 invoke void @"\01?may_throw@@YAXXZ"()
134 to label %invoke.cont unwind label %lpad1
136 invoke.cont: ; preds = %entry
137 %1 = load i8, i8* %b.addr, align 1
138 %tobool = trunc i8 %1 to i1
139 br i1 %tobool, label %if.then, label %if.else
141 if.then: ; preds = %invoke.cont
142 invoke void @"\01?may_throw@@YAXXZ"()
143 to label %invoke.cont3 unwind label %lpad3
145 invoke.cont3: ; preds = %if.then
146 call void @"\01??_DS@@QEAA@XZ"(%struct.S* %s1) #4
149 lpad1: ; preds = %entry, %if.end
150 %2 = landingpad { i8*, i32 }
152 %recover = call i8* (...) @llvm.eh.actions(i32 0, void (i8*, i8*)* @"\01?test2@@YAX_N@Z.cleanup")
153 indirectbr i8* %recover, []
155 lpad3: ; preds = %if.then
156 %3 = landingpad { i8*, i32 }
158 %recover4 = call i8* (...) @llvm.eh.actions(i32 0, void (i8*, i8*)* @"\01?test2@@YAX_N@Z.cleanup1", i32 0, void (i8*, i8*)* @"\01?test2@@YAX_N@Z.cleanup")
159 indirectbr i8* %recover4, []
161 if.else: ; preds = %invoke.cont
162 call void @"\01?dont_throw@@YAXXZ"() #4
165 if.end: ; preds = %if.else, %invoke.cont3
166 invoke void @"\01?may_throw@@YAXXZ"()
167 to label %invoke.cont4 unwind label %lpad1
169 invoke.cont4: ; preds = %if.end
170 call void @"\01??_DS@@QEAA@XZ"(%struct.S* %s) #4
174 declare void @"\01?may_throw@@YAXXZ"() #3
176 ; Function Attrs: nounwind
177 declare void @"\01?dont_throw@@YAXXZ"() #1
179 ; Function Attrs: nounwind
180 declare void @"\01??1S@@QEAA@XZ"(%struct.S*) #1
182 ; Function Attrs: nounwind
183 declare i8* @llvm.eh.actions(...) #4
185 define internal void @"\01?test1@@YAXXZ.cleanup"(i8*, i8*) #5 {
187 %s = alloca %struct.S, align 1
188 call void @"\01??_DS@@QEAA@XZ"(%struct.S* %s) #4
192 ; Function Attrs: nounwind
193 declare void @llvm.localescape(...) #4
195 ; Function Attrs: nounwind readnone
196 declare i8* @llvm.localrecover(i8*, i8*, i32) #6
198 ; Function Attrs: nounwind
199 declare void @llvm.eh.unwindhelp(i8*) #4
201 define internal void @"\01?test2@@YAX_N@Z.cleanup"(i8*, i8*) #7 personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
203 %s.i8 = call i8* @llvm.localrecover(i8* bitcast (void (i1)* @"\01?test2@@YAX_N@Z" to i8*), i8* %1, i32 0)
204 %s = bitcast i8* %s.i8 to %struct.S*
205 call void @"\01??_DS@@QEAA@XZ"(%struct.S* %s) #4
206 invoke void @llvm.donothing()
207 to label %entry.split unwind label %stub
209 entry.split: ; preds = %entry
212 stub: ; preds = %entry
213 %2 = landingpad { i8*, i32 }
218 define internal void @"\01?test2@@YAX_N@Z.cleanup1"(i8*, i8*) #7 personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
220 %s1.i8 = call i8* @llvm.localrecover(i8* bitcast (void (i1)* @"\01?test2@@YAX_N@Z" to i8*), i8* %1, i32 1)
221 %s1 = bitcast i8* %s1.i8 to %struct.S*
222 call void @"\01??_DS@@QEAA@XZ"(%struct.S* %s1) #4
223 invoke void @llvm.donothing()
224 to label %entry.split unwind label %stub
226 entry.split: ; preds = %entry
229 stub: ; preds = %entry
230 %2 = landingpad { i8*, i32 }
235 declare void @llvm.donothing()
237 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?test1@@YAXXZ" }
238 attributes #1 = { nounwind "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" }
239 attributes #2 = { "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?test2@@YAX_N@Z" }
240 attributes #3 = { "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" }
241 attributes #4 = { nounwind }
242 attributes #5 = { "wineh-parent"="
\ 1?test1@@YAXXZ" }
243 attributes #6 = { nounwind readnone }
244 attributes #7 = { "wineh-parent"="
\ 1?test2@@YAX_N@Z" }
245 attributes #8 = { noreturn }