1 ; RUN: llc -verify-machineinstrs < %s | FileCheck %s
\r
3 ; CHECK-LABEL: "$cppxdata$?crash@@YAXH@Z":
\r
4 ; CHECK: .long ("$stateUnwindMap$?crash@@YAXH@Z")
\r
5 ; CHECK: .long ("$tryMap$?crash@@YAXH@Z")@IMGREL # TryBlockMap
\r
6 ; CHECK-NEXT: .long 6 # IPMapEntries
\r
7 ; CHECK-NEXT: .long ("$ip2state$?crash@@YAXH@Z")
\r
9 ; CHECK-LABEL: "$stateUnwindMap$?crash@@YAXH@Z":
\r
10 ; CHECK-NEXT: .long -1
\r
11 ; CHECK-NEXT: .long 0
\r
12 ; CHECK-NEXT: .long 0
\r
13 ; CHECK-NEXT: .long "?dtor$
\r
14 ; CHECK-NEXT: .long -1
\r
15 ; CHECK-NEXT: .long 0
\r
17 ; CHECK-LABEL: "$tryMap$?crash@@YAXH@Z":
\r
18 ; CHECK-NEXT: .long 0
\r
19 ; CHECK-NEXT: .long 1
\r
20 ; CHECK-NEXT: .long 2
\r
21 ; CHECK-NEXT: .long 1
\r
22 ; CHECK-NEXT: .long ("$handlerMap$
\r
24 ; CHECK: "$handlerMap$0$?crash@@YAXH@Z"
\r
25 ; CHECK-NEXT: .long 0
\r
26 ; CHECK-NEXT: .long 0
\r
27 ; CHECK-NEXT: .long 0
\r
28 ; CHECK-NEXT: .long "?catch$
\r
30 ; CHECK-LABEL: "$ip2state$?crash@@YAXH@Z":
\r
31 ; CHECK-NEXT: .long .Lfunc_begin0@IMGREL
\r
32 ; CHECK-NEXT: .long -1
\r
33 ; CHECK-NEXT: .long .Ltmp
\r
34 ; CHECK-NEXT: .long 0
\r
35 ; CHECK-NEXT: .long .Ltmp
\r
36 ; CHECK-NEXT: .long 1
\r
37 ; CHECK-NEXT: .long .Ltmp
\r
38 ; CHECK-NEXT: .long 0
\r
39 ; CHECK-NEXT: .long .Ltmp
\r
40 ; CHECK-NEXT: .long -1
\r
41 ; CHECK-NEXT: .long "?catch$
\r
42 ; CHECK-NEXT: .long 2
\r
44 ; ModuleID = 'windows-seh-EHa-CppCatchDotDotDot.cpp'
\r
45 source_filename = "windows-seh-EHa-CppCatchDotDotDot.cpp"
\r
46 target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
\r
47 target triple = "x86_64-unknown-windows-msvc"
\r
49 %rtti.TypeDescriptor2 = type { i8**, i8*, [3 x i8] }
\r
50 %eh.CatchableType = type { i32, i32, i32, i32, i32, i32, i32 }
\r
51 %eh.CatchableTypeArray.1 = type { i32, [1 x i32] }
\r
52 %eh.ThrowInfo = type { i32, i32, i32, i32 }
\r
53 %struct.A = type { i8 }
\r
55 $"??_C@_0BJ@EIKFKKLB@?5in?5catch?$CI?4?4?4?$CJ?5funclet?5?6?$AA@" = comdat any
\r
57 $"??_R0H@8" = comdat any
\r
59 $"_CT??_R0H@84" = comdat any
\r
61 $_CTA1H = comdat any
\r
65 $"??_C@_0CN@MKCAOFNA@?5Test?5CPP?5unwind?3?5in?5except?5hand@" = comdat any
\r
67 $"??_C@_0N@LJHFFAKD@?5in?5A?5ctor?5?6?$AA@" = comdat any
\r
69 $"??_C@_0N@HMNCGOCN@?5in?5A?5dtor?5?6?$AA@" = comdat any
\r
71 @"?pt1@@3PEAHEA" = dso_local global i32* null, align 8
\r
72 @"?pt2@@3PEAHEA" = dso_local global i32* null, align 8
\r
73 @"?pt3@@3PEAHEA" = dso_local global i32* null, align 8
\r
74 @"?g@@3HA" = dso_local global i32 0, align 4
\r
75 @"??_C@_0BJ@EIKFKKLB@?5in?5catch?$CI?4?4?4?$CJ?5funclet?5?6?$AA@" = linkonce_odr dso_local unnamed_addr constant [25 x i8] c" in catch(...) funclet \0A\00", comdat, align 1
\r
76 @"??_7type_info@@6B@" = external constant i8*
\r
77 @"??_R0H@8" = linkonce_odr global %rtti.TypeDescriptor2 { i8** @"??_7type_info@@6B@", i8* null, [3 x i8] c".H\00" }, comdat
\r
78 @__ImageBase = external dso_local constant i8
\r
79 @"_CT??_R0H@84" = linkonce_odr unnamed_addr constant %eh.CatchableType { i32 1, i32 trunc (i64 sub nuw nsw (i64 ptrtoint (%rtti.TypeDescriptor2* @"??_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
\r
80 @_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
\r
81 @_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
\r
82 @"??_C@_0CN@MKCAOFNA@?5Test?5CPP?5unwind?3?5in?5except?5hand@" = linkonce_odr dso_local unnamed_addr constant [45 x i8] c" Test CPP unwind: in except handler i = %d \0A\00", comdat, align 1
\r
83 @"??_C@_0N@LJHFFAKD@?5in?5A?5ctor?5?6?$AA@" = linkonce_odr dso_local unnamed_addr constant [13 x i8] c" in A ctor \0A\00", comdat, align 1
\r
84 @"??_C@_0N@HMNCGOCN@?5in?5A?5dtor?5?6?$AA@" = linkonce_odr dso_local unnamed_addr constant [13 x i8] c" in A dtor \0A\00", comdat, align 1
\r
86 ; Function Attrs: noinline nounwind optnone
\r
87 define dso_local void @"?foo@@YAXXZ"() #0 {
\r
89 store volatile i32 0, i32* inttoptr (i64 17 to i32*), align 4
\r
93 ; Function Attrs: noinline optnone
\r
94 define dso_local void @"?crash@@YAXH@Z"(i32 %i) #1 personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
\r
96 %i.addr = alloca i32, align 4
\r
97 %ObjA = alloca %struct.A, align 1
\r
98 %tmp = alloca i32, align 4
\r
99 store i32 %i, i32* %i.addr, align 4
\r
100 %0 = load i32, i32* %i.addr, align 4
\r
101 store i32 %0, i32* @"?g@@3HA", align 4
\r
102 invoke void @llvm.seh.try.begin()
\r
103 to label %invoke.cont unwind label %catch.dispatch
\r
105 invoke.cont: ; preds = %entry
\r
106 %call = invoke %struct.A* @"??0A@?1??crash@@YAXH@Z@QEAA@XZ"(%struct.A* %ObjA)
\r
107 to label %invoke.cont1 unwind label %catch.dispatch
\r
109 invoke.cont1: ; preds = %invoke.cont
\r
110 invoke void @llvm.seh.scope.begin()
\r
111 to label %invoke.cont2 unwind label %ehcleanup
\r
113 invoke.cont2: ; preds = %invoke.cont1
\r
114 %1 = load i32, i32* %i.addr, align 4
\r
115 %cmp = icmp eq i32 %1, 1
\r
116 br i1 %cmp, label %if.then, label %if.end
\r
118 if.then: ; preds = %invoke.cont2
\r
119 store volatile i32 0, i32* inttoptr (i64 17 to i32*), align 4
\r
122 if.end: ; preds = %if.then, %invoke.cont2
\r
123 invoke void @llvm.seh.scope.end()
\r
124 to label %invoke.cont3 unwind label %ehcleanup
\r
126 invoke.cont3: ; preds = %if.end
\r
127 call void @"??1A@?1??crash@@YAXH@Z@QEAA@XZ"(%struct.A* %ObjA) #6
\r
130 ehcleanup: ; preds = %if.end, %invoke.cont1
\r
131 %2 = cleanuppad within none []
\r
132 call void @"??1A@?1??crash@@YAXH@Z@QEAA@XZ"(%struct.A* %ObjA) #6 [ "funclet"(token %2) ]
\r
133 cleanupret from %2 unwind label %catch.dispatch
\r
135 catch.dispatch: ; preds = %ehcleanup, %invoke.cont, %entry
\r
136 %3 = catchswitch within none [label %catch] unwind to caller
\r
138 catch: ; preds = %catch.dispatch
\r
139 %4 = catchpad within %3 [i8* null, i32 0, i8* null]
\r
140 call void (...) @"?printf@@YAXZZ"(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @"??_C@_0BJ@EIKFKKLB@?5in?5catch?$CI?4?4?4?$CJ?5funclet?5?6?$AA@", i64 0, i64 0)) [ "funclet"(token %4) ]
\r
141 %5 = load i32, i32* %i.addr, align 4
\r
142 %cmp4 = icmp eq i32 %5, 1
\r
143 br i1 %cmp4, label %if.then5, label %if.end6
\r
145 if.then5: ; preds = %catch
\r
146 %6 = load i32, i32* %i.addr, align 4
\r
147 store i32 %6, i32* %tmp, align 4
\r
148 %7 = bitcast i32* %tmp to i8*
\r
149 call void @_CxxThrowException(i8* %7, %eh.ThrowInfo* @_TI1H) #7 [ "funclet"(token %4) ]
\r
152 if.end6: ; preds = %catch
\r
153 catchret from %4 to label %catchret.dest
\r
155 catchret.dest: ; preds = %if.end6
\r
158 try.cont: ; preds = %catchret.dest, %invoke.cont3
\r
162 ; Function Attrs: nounwind willreturn
\r
163 declare dso_local void @llvm.seh.try.begin() #2
\r
165 declare dso_local i32 @__CxxFrameHandler3(...)
\r
167 ; Function Attrs: noinline optnone
\r
168 define internal %struct.A* @"??0A@?1??crash@@YAXH@Z@QEAA@XZ"(%struct.A* returned %this) unnamed_addr #1 align 2 {
\r
170 %retval = alloca %struct.A*, align 8
\r
171 %this.addr = alloca %struct.A*, align 8
\r
172 store %struct.A* %this, %struct.A** %this.addr, align 8
\r
173 %this1 = load %struct.A*, %struct.A** %this.addr, align 8
\r
174 store %struct.A* %this1, %struct.A** %retval, align 8
\r
175 call void (...) @"?printf@@YAXZZ"(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @"??_C@_0N@LJHFFAKD@?5in?5A?5ctor?5?6?$AA@", i64 0, i64 0))
\r
176 %0 = load i32, i32* @"?g@@3HA", align 4
\r
177 %cmp = icmp eq i32 %0, 0
\r
178 br i1 %cmp, label %if.then, label %if.end
\r
180 if.then: ; preds = %entry
\r
181 store volatile i32 0, i32* inttoptr (i64 17 to i32*), align 4
\r
184 if.end: ; preds = %if.then, %entry
\r
185 %1 = load %struct.A*, %struct.A** %retval, align 8
\r
189 ; Function Attrs: nounwind readnone
\r
190 declare dso_local void @llvm.seh.scope.begin() #3
\r
192 ; Function Attrs: nounwind readnone
\r
193 declare dso_local void @llvm.seh.scope.end() #3
\r
195 ; Function Attrs: noinline nounwind optnone
\r
196 define internal void @"??1A@?1??crash@@YAXH@Z@QEAA@XZ"(%struct.A* %this) unnamed_addr #0 align 2 {
\r
198 %this.addr = alloca %struct.A*, align 8
\r
199 store %struct.A* %this, %struct.A** %this.addr, align 8
\r
200 %this1 = load %struct.A*, %struct.A** %this.addr, align 8
\r
201 call void (...) @"?printf@@YAXZZ"(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @"??_C@_0N@HMNCGOCN@?5in?5A?5dtor?5?6?$AA@", i64 0, i64 0))
\r
205 declare dso_local void @"?printf@@YAXZZ"(...) #4
\r
207 declare dso_local void @_CxxThrowException(i8*, %eh.ThrowInfo*)
\r
209 ; Function Attrs: noinline norecurse optnone
\r
210 define dso_local i32 @main() #5 personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) {
\r
212 %retval = alloca i32, align 4
\r
213 %i = alloca i32, align 4
\r
214 %__exception_code = alloca i32, align 4
\r
215 store i32 0, i32* %retval, align 4
\r
216 store i32 0, i32* %i, align 4
\r
219 for.cond: ; preds = %for.inc, %entry
\r
220 %0 = load i32, i32* %i, align 4
\r
221 %cmp = icmp slt i32 %0, 2
\r
222 br i1 %cmp, label %for.body, label %for.end
\r
224 for.body: ; preds = %for.cond
\r
225 invoke void @llvm.seh.try.begin()
\r
226 to label %invoke.cont unwind label %catch.dispatch
\r
228 invoke.cont: ; preds = %for.body
\r
229 %1 = load volatile i32, i32* %i, align 4
\r
230 invoke void @"?crash@@YAXH@Z"(i32 %1) #8
\r
231 to label %invoke.cont1 unwind label %catch.dispatch
\r
233 invoke.cont1: ; preds = %invoke.cont
\r
234 invoke void @llvm.seh.try.end()
\r
235 to label %invoke.cont2 unwind label %catch.dispatch
\r
237 catch.dispatch: ; preds = %invoke.cont1, %invoke.cont, %for.body
\r
238 %2 = catchswitch within none [label %__except] unwind to caller
\r
240 __except: ; preds = %catch.dispatch
\r
241 %3 = catchpad within %2 [i8* null]
\r
242 catchret from %3 to label %__except3
\r
244 __except3: ; preds = %__except
\r
245 %4 = call i32 @llvm.eh.exceptioncode(token %3)
\r
246 store i32 %4, i32* %__exception_code, align 4
\r
247 %5 = load i32, i32* %i, align 4
\r
248 call void (...) @"?printf@@YAXZZ"(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @"??_C@_0CN@MKCAOFNA@?5Test?5CPP?5unwind?3?5in?5except?5hand@", i64 0, i64 0), i32 %5)
\r
249 br label %__try.cont
\r
251 __try.cont: ; preds = %__except3, %invoke.cont2
\r
254 for.inc: ; preds = %__try.cont
\r
255 %6 = load i32, i32* %i, align 4
\r
256 %inc = add nsw i32 %6, 1
\r
257 store i32 %inc, i32* %i, align 4
\r
260 invoke.cont2: ; preds = %invoke.cont1
\r
261 br label %__try.cont
\r
263 for.end: ; preds = %for.cond
\r
267 declare dso_local i32 @__C_specific_handler(...)
\r
269 ; Function Attrs: nounwind willreturn
\r
270 declare dso_local void @llvm.seh.try.end() #2
\r
272 ; Function Attrs: nounwind readnone
\r
273 declare i32 @llvm.eh.exceptioncode(token) #3
\r
275 attributes #0 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
\r
276 attributes #1 = { noinline optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
\r
277 attributes #2 = { nounwind willreturn }
\r
278 attributes #3 = { nounwind readnone }
\r
279 attributes #4 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
\r
280 attributes #5 = { noinline norecurse optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
\r
281 attributes #6 = { nounwind }
\r
282 attributes #7 = { noreturn }
\r
283 attributes #8 = { noinline }
\r
285 !llvm.module.flags = !{!0, !1}
\r
287 !0 = !{i32 1, !"wchar_size", i32 2}
\r
288 !1 = !{i32 2, !"eh-asynch", i32 1}
\r