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 ptr @__CxxFrameHandler3 {
12 %alloca2 = alloca ptr, align 4
13 %alloca1 = alloca ptr, align 4
14 store volatile ptr null, ptr %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 [ptr null, i32 0, ptr %alloca1]
38 %v = load volatile ptr, ptr %alloca1
39 store volatile ptr null, ptr %alloca1
40 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %alloca1)
41 call void @llvm.lifetime.start.p0(i64 4, ptr %alloca2)
42 store volatile ptr null, ptr %alloca1
43 call void @llvm.trap()
46 ; X64-LABEL: "?catch$2@?0?test1@4HA"
47 ; X64: movq $0, -8(%rbp)
48 ; X64: movq $0, -8(%rbp)
51 ; X86-LABEL: "?catch$2@?0?test1@4HA"
52 ; X86: movl $0, -32(%ebp)
53 ; X86: movl $0, -32(%ebp)
56 unreachable: ; preds = %entry
60 ; X64-LABEL: $cppxdata$test1:
61 ; X64: .long 40 # CatchObjOffset
63 ; -20 is difference between the end of the EH reg node stack object and the
64 ; catch object at EBP -32.
65 ; X86-LABEL: L__ehtable$test1:
66 ; X86: .long -20 # CatchObjOffset
68 define void @test2() personality ptr @__CxxFrameHandler3 {
70 %alloca2 = alloca ptr, align 4
71 %alloca1 = alloca ptr, align 4
72 store volatile ptr null, ptr %alloca1
74 to label %unreachable unwind label %catch.dispatch
77 ; X64: movq $0, -16(%rbp)
81 ; X86: movl $0, -32(%ebp)
85 catch.dispatch: ; preds = %entry
86 %cs = catchswitch within none [label %catch.pad] unwind to caller
88 catch.pad: ; preds = %catch.dispatch
89 %cp = catchpad within %cs [ptr null, i32 0, ptr null]
90 store volatile ptr null, ptr %alloca1
91 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %alloca1)
92 call void @llvm.lifetime.start.p0(i64 4, ptr %alloca2)
93 store volatile ptr null, ptr %alloca1
94 call void @llvm.trap()
97 ; X64-LABEL: "?catch$2@?0?test2@4HA"
98 ; X64: movq $0, -16(%rbp)
99 ; X64: movq $0, -16(%rbp)
102 ; X86-LABEL: "?catch$2@?0?test2@4HA"
103 ; X86: movl $0, -32(%ebp)
104 ; X86: movl $0, -32(%ebp)
108 unreachable: ; preds = %entry
112 ; X64-LABEL: $cppxdata$test2:
113 ; X64: .long 0 # CatchObjOffset
116 ; X86-LABEL: L__ehtable$test2:
117 ; X86: .long 0 # CatchObjOffset
120 ; Function Attrs: argmemonly nounwind
121 declare void @llvm.lifetime.start.p0(i64, ptr nocapture) #0
123 ; Function Attrs: argmemonly nounwind
124 declare void @llvm.lifetime.end.p0(i64, ptr nocapture) #0
126 attributes #0 = { argmemonly nounwind }