1; RUN: llc -mtriple aarch64-unknown-unknown -global-isel \
2; RUN:     -no-stack-coloring=false -pass-remarks-missed=gisel* < %s \
3; RUN:      2>&1 | FileCheck %s
4
5; Same as the dynamic-alloca-lifetime.ll X86 test, which was used to fix a bug
6; in stack colouring + lifetime markers.
7
8; This test crashed in PEI because the stack protector was dead.
9; This was due to it being colored, which was in turn due to incorrect
10; lifetimes being applied to the stack protector frame index.
11
12; CHECK: stack_chk_guard
13; CHECK-NOT: remark{{.*}}foo
14
15; Function Attrs: nounwind
16declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #0
17
18; Function Attrs: nounwind
19declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #0
20
21; Function Attrs: ssp
22define void @foo(i1 %cond1, i1 %cond2) #1 {
23entry:
24  %bitmapBuffer = alloca [8192 x i8], align 1
25  br i1 %cond1, label %end1, label %bb1
26
27bb1:
28  %bitmapBuffer229 = alloca [8192 x i8], align 1
29  br i1 %cond2, label %end1, label %if.else130
30
31end1:
32  ret void
33
34if.else130:                                       ; preds = %bb1
35  %tmp = getelementptr inbounds [8192 x i8], [8192 x i8]* %bitmapBuffer, i32 0, i32 0
36  call void @llvm.lifetime.start.p0i8(i64 8192, i8* %tmp) #0
37  call void @llvm.lifetime.end.p0i8(i64 8192, i8* %tmp) #0
38  %tmp25 = getelementptr inbounds [8192 x i8], [8192 x i8]* %bitmapBuffer229, i32 0, i32 0
39  call void @llvm.lifetime.start.p0i8(i64 8192, i8* %tmp25) #0
40  call void @llvm.lifetime.end.p0i8(i64 8192, i8* %tmp25) #0
41  br label %end1
42}
43
44declare void @bar()
45
46attributes #0 = { nounwind }
47attributes #1 = { ssp }
48