1 ;; RUN: opt -S -aarch64-stack-tagging %s -o - | FileCheck %s
2 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
3 target triple = "aarch64"
5 define void @f() local_unnamed_addr #0 {
8 ; CHECK: %basetag = call ptr @llvm.aarch64.irg.sp(i64 0)
9 %v = alloca i8, i32 48, align 8
10 ; CHECK: %v.tag = call ptr @llvm.aarch64.tagp.p0(ptr %v, ptr %basetag, i64 0)
11 %w = alloca i8, i32 48, align 16
12 ; CHECK: %w.tag = call ptr @llvm.aarch64.tagp.p0(ptr %w, ptr %basetag, i64 1)
14 %t0 = call i32 @g0() #1
15 %b0 = icmp eq i32 %t0, 0
16 br i1 %b0, label %S1, label %exit3
20 call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %v) #1
21 ; CHECK: call void @llvm.aarch64.settag(ptr %v.tag, i64 48)
22 call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %w) #1
23 ; CHECK: call void @llvm.aarch64.settag(ptr %w.tag, i64 48)
24 %t1 = call i32 @g1(ptr nonnull %v, ptr nonnull %w) #1
26 ; CHECK-NOT: settag{{.*}}%v
27 ; CHECK: call void @llvm.aarch64.settag(ptr %w, i64 48)
28 ; CHECK-NOT: settag{{.*}}%v
29 call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %w) #1
30 ; CHECK: call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %w)
31 %b1 = icmp eq i32 %t1, 0
32 br i1 %b1, label %S2, label %S3
43 call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %v) #1
44 tail call void @z1() #1
50 ; CHECK: call void @llvm.aarch64.settag(ptr %v, i64 48)
55 ; CHECK: call void @llvm.aarch64.settag(ptr %v, i64 48)
68 declare i32 @g1(ptr, ptr) #0
76 declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
78 declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
80 attributes #0 = { sanitize_memtag "correctly-rounded-divide-sqrt-fp-math"="false" "denormal-fp-math"="preserve-sign" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="true" "no-jump-tables"="false" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+mte,+neon,+v8.5a" "unsafe-fp-math"="false" "use-soft-float"="false" }
81 attributes #1 = { nounwind }