1 ; RUN: opt -safe-stack -safe-stack-coloring=1 -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
3 ; %x and %y share a stack slot between them, but not with the stack guard.
4 define void @f() safestack sspreq {
5 ; CHECK-LABEL: define void @f
7 ; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
8 ; CHECK: getelementptr i8, i8* %[[USP]], i32 -16
10 ; CHECK: %[[A:.*]] = getelementptr i8, i8* %[[USP]], i32 -8
11 ; CHECK: %[[StackGuardSlot:.*]] = bitcast i8* %[[A]] to i8**
12 ; CHECK: store i8* %{{.*}}, i8** %[[StackGuardSlot]]
14 %x = alloca i64, align 8
15 %y = alloca i64, align 8
16 %x0 = bitcast i64* %x to i8*
17 %y0 = bitcast i64* %y to i8*
19 call void @llvm.lifetime.start.p0i8(i64 -1, i8* %x0)
20 ; CHECK: getelementptr i8, i8* %[[USP]], i32 -16
21 call void @capture64(i64* %x)
22 call void @llvm.lifetime.end.p0i8(i64 -1, i8* %x0)
24 call void @llvm.lifetime.start.p0i8(i64 -1, i8* %y0)
25 ; CHECK: getelementptr i8, i8* %[[USP]], i32 -16
26 call void @capture64(i64* %y)
27 call void @llvm.lifetime.end.p0i8(i64 -1, i8* %y0)
32 declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
33 declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
34 declare void @capture64(i64*)