1 ; RUN: llc -mtriple=x86_64-windows-msvc < %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 %eh.ThrowInfo = type { i32, i32, i32, i32 }
7 %rtti.TypeDescriptor2 = type { i8**, i8*, [3 x i8] }
9 @"\01??_7type_info@@6B@" = external constant i8*
10 @"\01??_R0H@8" = internal global %rtti.TypeDescriptor2 { i8** @"\01??_7type_info@@6B@", i8* null, [3 x i8] c".H\00" }
12 define void @test1(i1 %B) personality i32 (...)* @__CxxFrameHandler3 {
15 to label %unreachable unwind label %catch.dispatch
18 %cs1 = catchswitch within none [label %catch] unwind to caller
21 %cp = catchpad within %cs1 [i8* null, i32 64, i8* null]
25 br i1 %B, label %catchret, label %catch.loop
28 catchret from %cp to label %try.cont
39 ; The entry funclet contains %entry and %try.cont
44 ; The catch funclet contains %catch and %catchret
45 ; CHECK: # %catch{{$}}
52 define i32 @test2(i1 %B) personality i32 (...)* @__CxxFrameHandler3 {
54 invoke void @_CxxThrowException(i8* null, %eh.ThrowInfo* null) #1
55 to label %unreachable unwind label %catch.dispatch
57 catch.dispatch: ; preds = %entry
58 %cs1 = catchswitch within none [label %catch] unwind to caller
60 catch: ; preds = %catch.dispatch
61 %0 = catchpad within %cs1 [i8* null, i32 64, i8* null]
62 invoke void @_CxxThrowException(i8* null, %eh.ThrowInfo* null) #1 ["funclet"(token %0)]
63 to label %unreachable unwind label %catch.dispatch.1
65 catch.dispatch.1: ; preds = %catch
66 %cs2 = catchswitch within %0 [label %catch.3] unwind to caller
68 catch.3: ; preds = %catch.dispatch.1
69 %1 = catchpad within %cs2 [i8* null, i32 64, i8* null]
70 catchret from %1 to label %try.cont
72 try.cont: ; preds = %catch.3
73 catchret from %0 to label %try.cont.5
75 try.cont.5: ; preds = %try.cont
78 unreachable: ; preds = %catch, %entry
84 ; The parent function contains %entry and %try.cont.5
87 ; CHECK: # %try.cont.5
90 ; The inner catch funclet contains %catch.3
92 ; CHECK: # %catch.3{{$}}
95 ; The outer catch funclet contains %catch
97 ; CHECK: # %catch{{$}}
98 ; CHECK: callq _CxxThrowException
99 ; CHECK: # %unreachable
103 define void @test3(i1 %V) #0 personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
106 to label %try.cont unwind label %catch.dispatch
108 catch.dispatch: ; preds = %entry
109 %cs1 = catchswitch within none [label %catch.2] unwind label %catch.dispatch.1
111 catch.2: ; preds = %catch.dispatch
112 %0 = catchpad within %cs1 [%rtti.TypeDescriptor2* @"\01??_R0H@8", i32 0, i8* null]
113 tail call void @exit(i32 0) #2 [ "funclet"(token %0) ]
116 catch.dispatch.1: ; preds = %catch.dispatch
117 %cs2 = catchswitch within none [label %catch] unwind to caller
119 catch: ; preds = %catch.dispatch.1
120 %1 = catchpad within %cs2 [i8* null, i32 64, i8* null]
121 tail call void @exit(i32 0) #2 [ "funclet"(token %1) ]
124 try.cont: ; preds = %entry
125 br i1 %V, label %exit_one, label %exit_two
128 tail call void @exit(i32 0)
132 tail call void @exit(i32 0)
136 ; CHECK-LABEL: test3:
138 ; The entry funclet contains %entry and %try.cont
142 ; CHECK-NOT: # exit_one
143 ; CHECK-NOT: # exit_two
146 ; The catch(...) funclet contains %catch.2
147 ; CHECK: # %catch.2{{$}}
151 ; The catch(int) funclet contains %catch
152 ; CHECK: # %catch{{$}}
156 declare void @exit(i32) noreturn nounwind
157 declare void @_CxxThrowException(i8*, %eh.ThrowInfo*)
158 declare i32 @__CxxFrameHandler3(...)