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