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:"$cppxdata$?test1@@YAXXZ":
34 ; CHECK-NEXT: .long 429065506
36 ; CHECK-NEXT: .long ("$stateUnwindMap$?test1@@YAXXZ")@IMGREL
40 ; CHECK-NEXT: .long ("$ip2state$?test1@@YAXXZ")@IMGREL
41 ; CHECK-NEXT: .long 32
44 ; CHECK-NEXT:"$stateUnwindMap$?test1@@YAXXZ":
45 ; CHECK-NEXT: .long -1
46 ; CHECK-NEXT: .long "?test1@@YAXXZ.cleanup"@IMGREL
47 ; CHECK-NEXT:"$ip2state$?test1@@YAXXZ":
48 ; CHECK-NEXT: .long .Lfunc_begin0@IMGREL
49 ; CHECK-NEXT: .long -1
50 ; CHECK-NEXT: .long .Ltmp0@IMGREL
53 define void @"\01?test1@@YAXXZ"() #0 personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
55 %unwindhelp = alloca i64
56 %tmp = alloca i32, align 4
57 %exn.slot = alloca i8*
58 %ehselector.slot = alloca i32
59 store i32 0, i32* %tmp
60 %0 = bitcast i32* %tmp to i8*
61 call void (...) @llvm.localescape()
62 store volatile i64 -2, i64* %unwindhelp
63 %1 = bitcast i64* %unwindhelp to i8*
64 call void @llvm.eh.unwindhelp(i8* %1)
65 invoke void @_CxxThrowException(i8* %0, %eh.ThrowInfo* @_TI1H) #8
66 to label %unreachable unwind label %lpad1
68 lpad1: ; preds = %entry
69 %2 = landingpad { i8*, i32 }
71 %recover = call i8* (...) @llvm.eh.actions(i32 0, void (i8*, i8*)* @"\01?test1@@YAXXZ.cleanup")
72 indirectbr i8* %recover, []
74 unreachable: ; preds = %entry
78 declare void @_CxxThrowException(i8*, %eh.ThrowInfo*)
80 declare i32 @__CxxFrameHandler3(...)
82 ; Function Attrs: nounwind
83 define linkonce_odr void @"\01??_DS@@QEAA@XZ"(%struct.S* %this) unnamed_addr #1 comdat align 2 {
85 %this.addr = alloca %struct.S*, align 8
86 store %struct.S* %this, %struct.S** %this.addr, align 8
87 %this1 = load %struct.S*, %struct.S** %this.addr
88 call void @"\01??1S@@QEAA@XZ"(%struct.S* %this1) #4
92 ; CHECK-LABEL: "?test2@@YAX_N@Z":
93 ; CHECK: .seh_handlerdata
94 ; CHECK-NEXT: .long ("$cppxdata$?test2@@YAX_N@Z")@IMGREL
95 ; CHECK-NEXT:"$cppxdata$?test2@@YAX_N@Z":
96 ; CHECK-NEXT: .long 429065506
98 ; CHECK-NEXT: .long ("$stateUnwindMap$?test2@@YAX_N@Z")@IMGREL
100 ; CHECK-NEXT: .long 0
101 ; CHECK-NEXT: .long 4
102 ; CHECK-NEXT: .long ("$ip2state$?test2@@YAX_N@Z")@IMGREL
103 ; CHECK-NEXT: .long 40
104 ; CHECK-NEXT: .long 0
105 ; CHECK-NEXT: .long 1
106 ; CHECK-NEXT:"$stateUnwindMap$?test2@@YAX_N@Z":
107 ; CHECK-NEXT: .long -1
108 ; CHECK-NEXT: .long "?test2@@YAX_N@Z.cleanup"@IMGREL
109 ; CHECK-NEXT: .long 0
110 ; CHECK-NEXT: .long "?test2@@YAX_N@Z.cleanup1"@IMGREL
111 ; CHECK-NEXT:"$ip2state$?test2@@YAX_N@Z":
112 ; CHECK-NEXT: .long .Lfunc_begin1@IMGREL
113 ; CHECK-NEXT: .long -1
114 ; CHECK-NEXT: .long .Ltmp7@IMGREL
115 ; CHECK-NEXT: .long 0
116 ; CHECK-NEXT: .long .Ltmp9@IMGREL
117 ; CHECK-NEXT: .long 1
118 ; CHECK-NEXT: .long .Ltmp12@IMGREL
119 ; CHECK-NEXT: .long 0
121 define void @"\01?test2@@YAX_N@Z"(i1 zeroext %b) #2 personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
122 %b.addr = alloca i8, align 1
123 %s = alloca %struct.S, align 1
124 %exn.slot = alloca i8*
125 %ehselector.slot = alloca i32
126 %s1 = alloca %struct.S, align 1
127 %frombool = zext i1 %b to i8
128 store i8 %frombool, i8* %b.addr, align 1
129 call void (...) @llvm.localescape(%struct.S* %s, %struct.S* %s1)
130 call void @"\01?may_throw@@YAXXZ"()
131 invoke void @"\01?may_throw@@YAXXZ"()
132 to label %invoke.cont unwind label %lpad1
134 invoke.cont: ; preds = %entry
135 %1 = load i8, i8* %b.addr, align 1
136 %tobool = trunc i8 %1 to i1
137 br i1 %tobool, label %if.then, label %if.else
139 if.then: ; preds = %invoke.cont
140 invoke void @"\01?may_throw@@YAXXZ"()
141 to label %invoke.cont3 unwind label %lpad3
143 invoke.cont3: ; preds = %if.then
144 call void @"\01??_DS@@QEAA@XZ"(%struct.S* %s1) #4
147 lpad1: ; preds = %entry, %if.end
148 %2 = landingpad { i8*, i32 }
150 %recover = call i8* (...) @llvm.eh.actions(i32 0, void (i8*, i8*)* @"\01?test2@@YAX_N@Z.cleanup")
151 indirectbr i8* %recover, []
153 lpad3: ; preds = %if.then
154 %3 = landingpad { i8*, i32 }
156 %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")
157 indirectbr i8* %recover4, []
159 if.else: ; preds = %invoke.cont
160 call void @"\01?dont_throw@@YAXXZ"() #4
163 if.end: ; preds = %if.else, %invoke.cont3
164 invoke void @"\01?may_throw@@YAXXZ"()
165 to label %invoke.cont4 unwind label %lpad1
167 invoke.cont4: ; preds = %if.end
168 call void @"\01??_DS@@QEAA@XZ"(%struct.S* %s) #4
172 declare void @"\01?may_throw@@YAXXZ"() #3
174 ; Function Attrs: nounwind
175 declare void @"\01?dont_throw@@YAXXZ"() #1
177 ; Function Attrs: nounwind
178 declare void @"\01??1S@@QEAA@XZ"(%struct.S*) #1
180 ; Function Attrs: nounwind
181 declare i8* @llvm.eh.actions(...) #4
183 define internal void @"\01?test1@@YAXXZ.cleanup"(i8*, i8*) #5 {
185 %s = alloca %struct.S, align 1
186 call void @"\01??_DS@@QEAA@XZ"(%struct.S* %s) #4
190 ; Function Attrs: nounwind
191 declare void @llvm.localescape(...) #4
193 ; Function Attrs: nounwind readnone
194 declare i8* @llvm.localrecover(i8*, i8*, i32) #6
196 ; Function Attrs: nounwind
197 declare void @llvm.eh.unwindhelp(i8*) #4
199 define internal void @"\01?test2@@YAX_N@Z.cleanup"(i8*, i8*) #7 personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
201 %s.i8 = call i8* @llvm.localrecover(i8* bitcast (void (i1)* @"\01?test2@@YAX_N@Z" to i8*), i8* %1, i32 0)
202 %s = bitcast i8* %s.i8 to %struct.S*
203 call void @"\01??_DS@@QEAA@XZ"(%struct.S* %s) #4
204 invoke void @llvm.donothing()
205 to label %entry.split unwind label %stub
207 entry.split: ; preds = %entry
210 stub: ; preds = %entry
211 %2 = landingpad { i8*, i32 }
216 define internal void @"\01?test2@@YAX_N@Z.cleanup1"(i8*, i8*) #7 personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
218 %s1.i8 = call i8* @llvm.localrecover(i8* bitcast (void (i1)* @"\01?test2@@YAX_N@Z" to i8*), i8* %1, i32 1)
219 %s1 = bitcast i8* %s1.i8 to %struct.S*
220 call void @"\01??_DS@@QEAA@XZ"(%struct.S* %s1) #4
221 invoke void @llvm.donothing()
222 to label %entry.split unwind label %stub
224 entry.split: ; preds = %entry
227 stub: ; preds = %entry
228 %2 = landingpad { i8*, i32 }
233 declare void @llvm.donothing()
235 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" }
236 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" }
237 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" }
238 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" }
239 attributes #4 = { nounwind }
240 attributes #5 = { "wineh-parent"="
\ 1?test1@@YAXXZ" }
241 attributes #6 = { nounwind readnone }
242 attributes #7 = { "wineh-parent"="
\ 1?test2@@YAX_N@Z" }
243 attributes #8 = { noreturn }