Debian Codegraph @

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

raw
1 ; RUN: opt -safe-stack -safe-stack-coloring=1 -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
2 ; RUN: opt -safe-stack -safe-stack-coloring=1 -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
3 ; RUN: opt -passes=safe-stack -safe-stack-coloring=1 -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
4 ; RUN: opt -passes=safe-stack -safe-stack-coloring=1 -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
5
6 define void @f() safestack {
7 entry:
8 ; CHECK: %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
9 ; CHECK: %[[USST:.*]] = getelementptr i8, ptr %[[USP]], i32 -16
10
11 %x = alloca i32, align 4
12 %x1 = alloca i32, align 4
13 %x2 = alloca i32, align 4
14 call void @llvm.lifetime.start.p0(ptr %x)
15
16 ; CHECK: %[[A1:.*]] = getelementptr i8, ptr %[[USP]], i32 -4
17 ; CHECK: call void @capture(ptr nonnull %[[A1]])
18
19 call void @capture(ptr nonnull %x)
20 call void @llvm.lifetime.end.p0(ptr %x)
21 call void @llvm.lifetime.start.p0(ptr %x1)
22
23 ; CHECK: %[[B1:.*]] = getelementptr i8, ptr %[[USP]], i32 -4
24 ; CHECK: call void @capture(ptr nonnull %[[B1]])
25
26 call void @capture(ptr nonnull %x1)
27 call void @llvm.lifetime.end.p0(ptr %x1)
28 call void @llvm.lifetime.start.p0(ptr %x2)
29
30 ; CHECK: %[[C1:.*]] = getelementptr i8, ptr %[[USP]], i32 -4
31 ; CHECK: call void @capture(ptr nonnull %[[C1]])
32
33 call void @capture(ptr nonnull %x2)
34 call void @llvm.lifetime.end.p0(ptr %x2)
35 ret void
36 }
37
38 declare void @llvm.lifetime.start.p0(ptr nocapture)
39 declare void @llvm.lifetime.end.p0(ptr nocapture)
40 declare void @capture(ptr)