1 ; Regression test for safestack layout. Used to fail with asan.
2 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
4 define void @f() safestack {
5 ; CHECK-LABEL: define void @f
7 ; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
8 ; CHECK: getelementptr i8, i8* %[[USP]], i32 -224
10 %x0 = alloca i8, align 16
11 %x1 = alloca i8, align 16
12 %x2 = alloca i8, align 16
13 %x3 = alloca i8, align 16
14 %x4 = alloca i8, align 16
15 %x5 = alloca i8, align 16
16 %x6 = alloca i8, align 16
17 %x7 = alloca i8, align 16
18 %x8 = alloca i8, align 16
19 %x9 = alloca i8, align 16
20 %x10 = alloca i8, align 16
21 %x11 = alloca i8, align 16
22 %x12 = alloca i8, align 16
23 %x13 = alloca i8, align 16
24 %y0 = alloca i8, align 2
25 %y1 = alloca i8, align 2
26 %y2 = alloca i8, align 2
27 %y3 = alloca i8, align 2
28 %y4 = alloca i8, align 2
29 %y5 = alloca i8, align 2
30 %y6 = alloca i8, align 2
31 %y7 = alloca i8, align 2
32 %y8 = alloca i8, align 2
34 ; CHECK: getelementptr i8, i8* %[[USP]], i32 -16
35 call void @capture8(i8* %x0)
36 ; CHECK: getelementptr i8, i8* %[[USP]], i32 -32
37 call void @capture8(i8* %x1)
38 ; CHECK: getelementptr i8, i8* %[[USP]], i32 -48
39 call void @capture8(i8* %x2)
40 ; CHECK: getelementptr i8, i8* %[[USP]], i32 -64
41 call void @capture8(i8* %x3)
42 ; CHECK: getelementptr i8, i8* %[[USP]], i32 -80
43 call void @capture8(i8* %x4)
44 ; CHECK: getelementptr i8, i8* %[[USP]], i32 -96
45 call void @capture8(i8* %x5)
46 ; CHECK: getelementptr i8, i8* %[[USP]], i32 -112
47 call void @capture8(i8* %x6)
48 ; CHECK: getelementptr i8, i8* %[[USP]], i32 -128
49 call void @capture8(i8* %x7)
50 ; CHECK: getelementptr i8, i8* %[[USP]], i32 -144
51 call void @capture8(i8* %x8)
52 ; CHECK: getelementptr i8, i8* %[[USP]], i32 -160
53 call void @capture8(i8* %x9)
54 ; CHECK: getelementptr i8, i8* %[[USP]], i32 -176
55 call void @capture8(i8* %x10)
56 ; CHECK: getelementptr i8, i8* %[[USP]], i32 -192
57 call void @capture8(i8* %x11)
58 ; CHECK: getelementptr i8, i8* %[[USP]], i32 -208
59 call void @capture8(i8* %x12)
60 ; CHECK: getelementptr i8, i8* %[[USP]], i32 -224
61 call void @capture8(i8* %x13)
62 ; CHECK: getelementptr i8, i8* %[[USP]], i32 -2
63 call void @capture8(i8* %y0)
64 ; CHECK: getelementptr i8, i8* %[[USP]], i32 -4
65 call void @capture8(i8* %y1)
66 ; CHECK: getelementptr i8, i8* %[[USP]], i32 -6
67 call void @capture8(i8* %y2)
68 ; CHECK: getelementptr i8, i8* %[[USP]], i32 -8
69 call void @capture8(i8* %y3)
70 ; CHECK: getelementptr i8, i8* %[[USP]], i32 -10
71 call void @capture8(i8* %y4)
72 ; CHECK: getelementptr i8, i8* %[[USP]], i32 -12
73 call void @capture8(i8* %y5)
74 ; CHECK: getelementptr i8, i8* %[[USP]], i32 -14
75 call void @capture8(i8* %y6)
76 ; CHECK: getelementptr i8, i8* %[[USP]], i32 -18
77 call void @capture8(i8* %y7)
78 ; CHECK: getelementptr i8, i8* %[[USP]], i32 -20
79 call void @capture8(i8* %y8)
84 declare void @capture8(i8*)