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 %cp = catchpad [i8* null, i32 64, i8* null]
19 to label %catch unwind label %catchendblock
22 br i1 %B, label %catchret, label %catch
25 catchret %cp to label %try.cont
31 catchendpad unwind to caller
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 %0 = catchpad [i8* null, i32 64, i8* null]
59 to label %catch unwind label %catchendblock
61 catch: ; preds = %catch.dispatch
62 invoke void @_CxxThrowException(i8* null, %eh.ThrowInfo* null) #1
63 to label %unreachable unwind label %catch.dispatch.1
65 catch.dispatch.1: ; preds = %catch
66 %1 = catchpad [i8* null, i32 64, i8* null]
67 to label %catch.3 unwind label %catchendblock.2
69 catch.3: ; preds = %catch.dispatch.1
70 catchret %1 to label %try.cont
72 try.cont: ; preds = %catch.3
73 catchret %0 to label %try.cont.5
75 try.cont.5: ; preds = %try.cont
78 catchendblock.2: ; preds = %catch.dispatch.1
79 catchendpad unwind label %catchendblock
81 catchendblock: ; preds = %catchendblock.2, %catch.dispatch
82 catchendpad unwind to caller
84 unreachable: ; preds = %catch, %entry
91 ; The entry funclet contains %entry and %try.cont.5
93 ; CHECK: # %try.cont.5
96 ; The outer catch funclet contains %catch.dispatch
97 ; CHECK: # %catch.dispatch{{$}}
98 ; CHECK: callq _CxxThrowException
99 ; CHECK: # %unreachable
102 ; The inner catch funclet contains %catch.dispatch.1
103 ; CHECK: # %catch.dispatch.1
107 define void @test3(i1 %V) #0 personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
110 to label %try.cont unwind label %catch.dispatch
112 catch.dispatch: ; preds = %entry
113 %0 = catchpad [%rtti.TypeDescriptor2* @"\01??_R0H@8", i32 0, i8* null]
114 to label %catch.2 unwind label %catch.dispatch.1
116 catch.2: ; preds = %catch.dispatch
117 tail call void @exit(i32 0) #2
120 catch.dispatch.1: ; preds = %catch.dispatch
121 %1 = catchpad [i8* null, i32 64, i8* null]
122 to label %catch unwind label %catchendblock
124 catch: ; preds = %catch.dispatch.1
125 tail call void @exit(i32 0) #2
128 catchendblock: ; preds = %catch.dispatch.1
129 catchendpad unwind to caller
131 try.cont: ; preds = %entry
132 br i1 %V, label %exit_one, label %exit_two
135 tail call void @exit(i32 0)
139 tail call void @exit(i32 0)
143 ; CHECK-LABEL: test3:
145 ; The entry funclet contains %entry and %try.cont
149 ; CHECK-NOT: # exit_one
150 ; CHECK-NOT: # exit_two
153 ; The catch(...) funclet contains %catch.dispatch
154 ; CHECK: # %catch.dispatch{{$}}
158 ; The catch(int) funclet contains %catch.dispatch.1
159 ; CHECK: # %catch.dispatch.1
163 declare void @exit(i32) noreturn nounwind
164 declare void @_CxxThrowException(i8*, %eh.ThrowInfo*)
165 declare i32 @__CxxFrameHandler3(...)