1 ; RUN: llc -mtriple=x86_64-windows-msvc < %s | FileCheck %s --check-prefix=X64
2 ; RUN: llc -mtriple=i686-windows-msvc < %s | FileCheck %s --check-prefix=X86
6 declare i32 @__CxxFrameHandler3(...)
8 declare void @llvm.trap()
10 define void @test1() personality i32 (...)* @__CxxFrameHandler3 {
12 %alloca2 = alloca i8*, align 4
13 %alloca1 = alloca i8*, align 4
14 store volatile i8* null, i8** %alloca1
16 to label %unreachable unwind label %catch.dispatch
19 ; X64: movq $0, -8(%rbp)
24 ; X86: movl %esp, %ebp
30 ; X86: movl $0, -32(%ebp)
33 catch.dispatch: ; preds = %entry
34 %cs = catchswitch within none [label %catch.pad] unwind to caller
36 catch.pad: ; preds = %catch.dispatch
37 %cp = catchpad within %cs [i8* null, i32 0, i8** %alloca1]
38 %v = load volatile i8*, i8** %alloca1
39 store volatile i8* null, i8** %alloca1
40 %bc1 = bitcast i8** %alloca1 to i8*
41 call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %bc1)
42 %bc2 = bitcast i8** %alloca2 to i8*
43 call void @llvm.lifetime.start.p0i8(i64 4, i8* %bc2)
44 store volatile i8* null, i8** %alloca1
45 call void @llvm.trap()
48 ; X64-LABEL: "?catch$2@?0?test1@4HA"
49 ; X64: movq $0, -8(%rbp)
50 ; X64: movq $0, -8(%rbp)
53 ; X86-LABEL: "?catch$2@?0?test1@4HA"
54 ; X86: movl $0, -32(%ebp)
55 ; X86: movl $0, -32(%ebp)
58 unreachable: ; preds = %entry
62 ; X64-LABEL: $cppxdata$test1:
63 ; X64: .long 56 # CatchObjOffset
65 ; -20 is difference between the end of the EH reg node stack object and the
66 ; catch object at EBP -32.
67 ; X86-LABEL: L__ehtable$test1:
68 ; X86: .long -20 # CatchObjOffset
70 define void @test2() personality i32 (...)* @__CxxFrameHandler3 {
72 %alloca2 = alloca i8*, align 4
73 %alloca1 = alloca i8*, align 4
74 store volatile i8* null, i8** %alloca1
76 to label %unreachable unwind label %catch.dispatch
79 ; X64: movq $0, -16(%rbp)
83 ; X86: movl $0, -32(%ebp)
87 catch.dispatch: ; preds = %entry
88 %cs = catchswitch within none [label %catch.pad] unwind to caller
90 catch.pad: ; preds = %catch.dispatch
91 %cp = catchpad within %cs [i8* null, i32 0, i8** null]
92 store volatile i8* null, i8** %alloca1
93 %bc1 = bitcast i8** %alloca1 to i8*
94 call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %bc1)
95 %bc2 = bitcast i8** %alloca2 to i8*
96 call void @llvm.lifetime.start.p0i8(i64 4, i8* %bc2)
97 store volatile i8* null, i8** %alloca1
98 call void @llvm.trap()
101 ; X64-LABEL: "?catch$2@?0?test2@4HA"
102 ; X64: movq $0, -16(%rbp)
103 ; X64: movq $0, -16(%rbp)
106 ; X86-LABEL: "?catch$2@?0?test2@4HA"
107 ; X86: movl $0, -32(%ebp)
108 ; X86: movl $0, -32(%ebp)
112 unreachable: ; preds = %entry
116 ; X64-LABEL: $cppxdata$test2:
117 ; X64: .long 0 # CatchObjOffset
120 ; X86-LABEL: L__ehtable$test2:
121 ; X86: .long 0 # CatchObjOffset
124 ; Function Attrs: argmemonly nounwind
125 declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #0
127 ; Function Attrs: argmemonly nounwind
128 declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #0
130 attributes #0 = { argmemonly nounwind }