Debian Codegraph @

llvm/test/Transforms/SafeStack/X86/coloring-ssp.ll

raw
1 ; RUN: opt -safe-stack -safe-stack-coloring=1 -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
2 ; RUN: opt -passes=safe-stack -safe-stack-coloring=1 -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
3
4 ; %x and %y share a stack slot between them, but not with the stack guard.
5 define void @f() safestack sspreq {
6 ; CHECK-LABEL: define void @f
7 entry:
8 ; CHECK: %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
9 ; CHECK: getelementptr i8, ptr %[[USP]], i32 -16
10
11 ; CHECK: %[[A:.*]] = getelementptr i8, ptr %[[USP]], i32 -8
12 ; CHECK: store ptr %{{.*}}, ptr %[[A]]
13
14 %x = alloca i64, align 8
15 %y = alloca i64, align 8
16
17 call void @llvm.lifetime.start.p0(ptr %x)
18 ; CHECK: getelementptr i8, ptr %[[USP]], i32 -16
19 call void @capture64(ptr %x)
20 call void @llvm.lifetime.end.p0(ptr %x)
21
22 call void @llvm.lifetime.start.p0(ptr %y)
23 ; CHECK: getelementptr i8, ptr %[[USP]], i32 -16
24 call void @capture64(ptr %y)
25 call void @llvm.lifetime.end.p0(ptr %y)
26
27 ret void
28 }
29
30 declare void @llvm.lifetime.start.p0(ptr nocapture)
31 declare void @llvm.lifetime.end.p0(ptr nocapture)
32 declare void @capture64(ptr)