1 ; We set a low dom-tree-reachability-max-bbs-to-explore to check whether the
2 ; loop analysis is working. Without skipping over the loop, we would need more
3 ; than 4 BB to reach end from entry.
5 ; RUN: opt -S -dom-tree-reachability-max-bbs-to-explore=4 -aarch64-stack-tagging %s -o - | FileCheck %s
7 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
8 target triple = "aarch64"
10 define dso_local void @foo(i1 %x, i32 %n) sanitize_memtag {
12 %c = alloca [1024 x i8], align 1
13 call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %c)
14 %cmp2.not = icmp eq i32 %n, 0
15 br i1 %x, label %entry2, label %noloop
18 br i1 %cmp2.not, label %for.cond.cleanup, label %for.body
20 for.cond.cleanup: ; preds = %for.body, %entry
21 ; CHECK-LABEL: for.cond.cleanup:
22 ; CHECK: call{{.*}}settag
23 ; CHECK: call{{.*}}lifetime.end
24 call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %c)
25 call void @bar(ptr noundef nonnull inttoptr (i64 120 to ptr))
28 for.body: ; preds = %entry, %for.body
29 %i.03 = phi i32 [ %inc, %for.body2 ], [ 0, %entry2 ]
30 call void @bar(ptr noundef nonnull %c) #3
34 %inc = add nuw nsw i32 %i.03, 1
35 %cmp = icmp ult i32 %inc, %n
36 br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !13
39 ; CHECK-LABEL: noloop:
40 ; CHECK: call{{.*}}settag
41 ; CHECK: call{{.*}}lifetime.end
42 call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %c)
47 ; CHECK-NOT: call{{.*}}settag
51 ; Function Attrs: argmemonly mustprogress nocallback nofree nosync nounwind willreturn
52 declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0
53 declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0
55 declare dso_local void @bar(ptr noundef)
57 attributes #0 = { argmemonly mustprogress nocallback nofree nosync nounwind willreturn }
59 !13 = distinct !{!13, !14}
60 !14 = !{!"llvm.loop.mustprogress"}