1; RUN: llc < %s | FileCheck %s
2
3target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
4target triple = "x86_64-pc-windows-msvc"
5
6declare void @throw()
7
8declare i32 @__CxxFrameHandler3(...)
9
10define void @test1() personality i32 (...)* @__CxxFrameHandler3 {
11entry:
12  %alloca2 = alloca i8*, align 4
13  %alloca1 = alloca i8*, align 4
14  store volatile i8* null, i8** %alloca1
15  invoke void @throw()
16          to label %unreachable unwind label %catch.dispatch
17
18; CHECK-LABEL: test1:
19; CHECK: movq  $0, -8(%rbp)
20; CHECK: callq throw
21
22catch.dispatch:                                   ; preds = %entry
23  %cs = catchswitch within none [label %catch.pad] unwind to caller
24
25catch.pad:                                        ; preds = %catch.dispatch
26  %cp = catchpad within %cs [i8* null, i32 0, i8** %alloca1]
27  store volatile i8* null, i8** %alloca1
28  %bc1 = bitcast i8** %alloca1 to i8*
29  call void @llvm.lifetime.end(i64 4, i8* nonnull %bc1)
30  %bc2 = bitcast i8** %alloca2 to i8*
31  call void @llvm.lifetime.start(i64 4, i8* %bc2)
32  store volatile i8* null, i8** %alloca1
33  unreachable
34
35; CHECK-LABEL: "?catch$2@?0?test1@4HA"
36; CHECK: movq  $0, -8(%rbp)
37; CHECK: movq  $0, -8(%rbp)
38; CHECK: ud2
39
40unreachable:                                      ; preds = %entry
41  unreachable
42}
43
44; CHECK-LABEL: $cppxdata$test1:
45; CHECK: .long   56                      # CatchObjOffset
46
47define void @test2() personality i32 (...)* @__CxxFrameHandler3 {
48entry:
49  %alloca2 = alloca i8*, align 4
50  %alloca1 = alloca i8*, align 4
51  store volatile i8* null, i8** %alloca1
52  invoke void @throw()
53          to label %unreachable unwind label %catch.dispatch
54
55; CHECK-LABEL: test2:
56; CHECK: movq  $0, -16(%rbp)
57; CHECK: callq throw
58
59catch.dispatch:                                   ; preds = %entry
60  %cs = catchswitch within none [label %catch.pad] unwind to caller
61
62catch.pad:                                        ; preds = %catch.dispatch
63  %cp = catchpad within %cs [i8* null, i32 0, i8** null]
64  store volatile i8* null, i8** %alloca1
65  %bc1 = bitcast i8** %alloca1 to i8*
66  call void @llvm.lifetime.end(i64 4, i8* nonnull %bc1)
67  %bc2 = bitcast i8** %alloca2 to i8*
68  call void @llvm.lifetime.start(i64 4, i8* %bc2)
69  store volatile i8* null, i8** %alloca1
70  unreachable
71
72; CHECK-LABEL: "?catch$2@?0?test2@4HA"
73; CHECK: movq  $0, -16(%rbp)
74; CHECK: movq  $0, -16(%rbp)
75; CHECK: ud2
76
77unreachable:                                      ; preds = %entry
78  unreachable
79}
80
81; CHECK-LABEL: $cppxdata$test2:
82; CHECK: .long   0                       # CatchObjOffset
83
84
85; Function Attrs: argmemonly nounwind
86declare void @llvm.lifetime.start(i64, i8* nocapture) #0
87
88; Function Attrs: argmemonly nounwind
89declare void @llvm.lifetime.end(i64, i8* nocapture) #0
90
91attributes #0 = { argmemonly nounwind }
92