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 declare void @llvm.trap()
14 define void @test1(i1 %B) personality i32 (...)* @__CxxFrameHandler3 {
17 to label %unreachable unwind label %catch.dispatch
20 %cs1 = catchswitch within none [label %catch] unwind to caller
23 %cp = catchpad within %cs1 [i8* null, i32 64, i8* null]
27 br i1 %B, label %catchret, label %catch.loop
30 catchret from %cp to label %try.cont
36 call void @llvm.trap()
42 ; The entry funclet contains %entry and %try.cont
47 ; The catch funclet contains %catch and %catchret
48 ; CHECK: # %catch{{$}}
55 define i32 @test2(i1 %B) personality i32 (...)* @__CxxFrameHandler3 {
57 invoke void @_CxxThrowException(i8* null, %eh.ThrowInfo* null) #1
58 to label %unreachable unwind label %catch.dispatch
60 catch.dispatch: ; preds = %entry
61 %cs1 = catchswitch within none [label %catch] unwind to caller
63 catch: ; preds = %catch.dispatch
64 %0 = catchpad within %cs1 [i8* null, i32 64, i8* null]
65 invoke void @_CxxThrowException(i8* null, %eh.ThrowInfo* null) #1 ["funclet"(token %0)]
66 to label %unreachable unwind label %catch.dispatch.1
68 catch.dispatch.1: ; preds = %catch
69 %cs2 = catchswitch within %0 [label %catch.3] unwind to caller
71 catch.3: ; preds = %catch.dispatch.1
72 %1 = catchpad within %cs2 [i8* null, i32 64, i8* null]
73 catchret from %1 to label %try.cont
75 try.cont: ; preds = %catch.3
76 catchret from %0 to label %try.cont.5
78 try.cont.5: ; preds = %try.cont
81 unreachable: ; preds = %catch, %entry
82 call void @llvm.trap()
88 ; The parent function contains %entry and %try.cont.5
91 ; CHECK: # %try.cont.5
94 ; The inner catch funclet contains %catch.3
96 ; CHECK: # %catch.3{{$}}
99 ; The outer catch funclet contains %catch
101 ; CHECK: # %catch{{$}}
102 ; CHECK: callq _CxxThrowException
103 ; CHECK: # %unreachable
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 %cs1 = catchswitch within none [label %catch.2] unwind label %catch.dispatch.1
115 catch.2: ; preds = %catch.dispatch
116 %0 = catchpad within %cs1 [%rtti.TypeDescriptor2* @"\01??_R0H@8", i32 0, i8* null]
117 tail call void @exit(i32 0) #2 [ "funclet"(token %0) ]
120 catch.dispatch.1: ; preds = %catch.dispatch
121 %cs2 = catchswitch within none [label %catch] unwind to caller
123 catch: ; preds = %catch.dispatch.1
124 %1 = catchpad within %cs2 [i8* null, i32 64, i8* null]
125 tail call void @exit(i32 0) #2 [ "funclet"(token %1) ]
128 try.cont: ; preds = %entry
129 br i1 %V, label %exit_one, label %exit_two
133 call void @llvm.trap()
138 call void @llvm.trap()
142 ; CHECK-LABEL: test3:
144 ; The entry funclet contains %entry and %try.cont
148 ; CHECK-NOT: # exit_one
149 ; CHECK-NOT: # exit_two
152 ; The catch(...) funclet contains %catch.2
153 ; CHECK: # %catch.2{{$}}
157 ; The catch(int) funclet contains %catch
158 ; CHECK: # %catch{{$}}
162 declare void @exit(i32) noreturn nounwind
163 declare void @_CxxThrowException(i8*, %eh.ThrowInfo*)
164 declare i32 @__CxxFrameHandler3(...)