1; Test that storage for allocas with disjoint lifetimes is reused with
2; use-after-scope.
3
4; RUN: opt -S -passes=hwasan %s -hwasan-use-after-scope -o - | \
5; RUN:   llc -no-stack-coloring=false -o - | \
6; RUN:   FileCheck %s --check-prefix=COLOR
7; RUN: opt -S -passes=hwasan -hwasan-use-after-scope %s -o - | \
8; RUN:   llc -no-stack-coloring=true -o - | \
9; RUN:   FileCheck %s --check-prefix=NOCOLOR
10
11target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
12target triple = "aarch64-unknown-linux-android29"
13
14; REQUIRES: aarch64-registered-target
15
16; COLOR: sub	sp, sp, #240
17; NOCOLOR: sub	sp, sp, #368
18
19define i32 @myCall_w2(i32 %in) sanitize_hwaddress {
20entry:
21  %a = alloca [17 x i8*], align 8
22  %a2 = alloca [16 x i8*], align 8
23  %b = bitcast [17 x i8*]* %a to i8*
24  %b2 = bitcast [16 x i8*]* %a2 to i8*
25  call void @llvm.lifetime.start.p0i8(i64 136, i8* %b)
26  %t1 = call i32 @foo(i32 %in, i8* %b)
27  %t2 = call i32 @foo(i32 %in, i8* %b)
28  call void @llvm.lifetime.end.p0i8(i64 136, i8* %b)
29  call void @llvm.lifetime.start.p0i8(i64 128, i8* %b2)
30  %t3 = call i32 @foo(i32 %in, i8* %b2)
31  %t4 = call i32 @foo(i32 %in, i8* %b2)
32  call void @llvm.lifetime.end.p0i8(i64 128, i8* %b2)
33  %t5 = add i32 %t1, %t2
34  %t6 = add i32 %t3, %t4
35  %t7 = add i32 %t5, %t6
36  ret i32 %t7
37}
38
39declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) nounwind
40
41declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) nounwind
42
43declare i32 @foo(i32, i8*)
44