1 ; RUN: opt -S -aarch64-stack-tagging -stack-tagging-use-stack-safety=0 %s -o - | FileCheck %s
3 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
4 target triple = "aarch64"
6 declare void @use8(ptr)
8 define void @f(i1 %cond) local_unnamed_addr sanitize_memtag {
11 %a = alloca i8, i32 48, align 8
12 call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %a)
13 call void @use8(ptr %a)
14 ; CHECK: call void @llvm.aarch64.settag(ptr %a.tag, i64 48)
15 br i1 %cond, label %next0, label %next1
19 ; CHECK: call void @llvm.aarch64.settag
20 call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %a)
25 ; CHECK-NOT: call void @llvm.aarch64.settag
30 ; CHECK: call void @llvm.aarch64.settag
31 call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %a)
36 ; CHECK-NOT: call void @llvm.aarch64.settag
40 define void @diamond(i1 %cond) local_unnamed_addr sanitize_memtag {
43 %a = alloca i8, i32 48, align 8
44 call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %a)
45 call void @use8(ptr %a)
46 ; CHECK: call void @llvm.aarch64.settag(ptr %a.tag, i64 48)
47 br i1 %cond, label %next0, label %next1
51 ; CHECK: call void @llvm.aarch64.settag
52 call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %a)
57 ; CHECK: call void @llvm.aarch64.settag
58 call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %a)
63 ; CHECK-NOT: call void @llvm.aarch64.settag
67 define void @diamond_nocover(i1 %cond) local_unnamed_addr sanitize_memtag {
70 %a = alloca i8, i32 48, align 8
71 call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %a)
72 call void @use8(ptr %a)
73 ; CHECK: call void @llvm.aarch64.settag(ptr %a.tag, i64 48)
74 br i1 %cond, label %next0, label %next1
78 ; CHECK-NOT: llvm.lifetime.end
79 call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %a)
84 ; CHECK-NOT: llvm.lifetime.end
89 ; CHECK: call void @llvm.aarch64.settag
93 define void @diamond3(i1 %cond, i1 %cond1) local_unnamed_addr sanitize_memtag {
96 %a = alloca i8, i32 48, align 8
97 call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %a)
98 call void @use8(ptr %a)
99 ; CHECK: call void @llvm.aarch64.settag(ptr %a.tag, i64 48)
100 br i1 %cond, label %next0, label %start1
103 br i1 %cond1, label %next1, label %next2
106 ; CHECK-LABEL: next0:
107 ; CHECK: call void @llvm.aarch64.settag
108 call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %a)
112 ; CHECK-LABEL: next1:
113 ; CHECK: call void @llvm.aarch64.settag
114 call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %a)
118 ; CHECK-LABEL: next2:
119 ; CHECK: call void @llvm.aarch64.settag
120 call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %a)
124 ; CHECK-LABEL: exit1:
125 ; CHECK-NOT: call void @llvm.aarch64.settag
129 define void @diamond3_nocover(i1 %cond, i1 %cond1) local_unnamed_addr sanitize_memtag {
131 ; CHECK-LABEL: start:
132 %a = alloca i8, i32 48, align 8
133 call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %a)
134 call void @use8(ptr %a)
135 ; CHECK: call void @llvm.aarch64.settag(ptr %a.tag, i64 48)
136 br i1 %cond, label %next0, label %start1
139 br i1 %cond1, label %next1, label %next2
142 ; CHECK-LABEL: next0:
143 ; CHECK-NOT: call void @llvm.aarch64.settag
144 call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %a)
148 ; CHECK-LABEL: next1:
149 ; CHECK-NOT: call void @llvm.aarch64.settag
150 call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %a)
154 ; CHECK-LABEL: next2:
155 ; CHECK-NOT: call void @llvm.aarch64.settag
159 ; CHECK-LABEL: exit1:
160 ; CHECK: call void @llvm.aarch64.settag
164 declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture)
165 declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture)