blob: f5e34c43462be5aba5348cafa032fd375b42ff59 [file] [log] [blame]
David Bozier3246aec2017-02-28 17:25:38 +00001; RUN: llc %s -mtriple=x86_64-unknown-unknown -pass-remarks=stack-protector -o /dev/null 2>&1 | FileCheck %s
David Bozier51599682017-02-28 16:02:37 +00002; CHECK-NOT: nossp
3; CHECK: function attribute_ssp
4; CHECK-SAME: a function attribute or command-line switch
5; CHECK-NOT: alloca_fixed_small_nossp
6; CHECK: function alloca_fixed_small_ssp
7; CHECK-SAME: a call to alloca or use of a variable length array
8; CHECK: function alloca_fixed_large_ssp
9; CHECK-SAME: a call to alloca or use of a variable length array
10; CHECK: function alloca_variable_ssp
11; CHECK-SAME: a call to alloca or use of a variable length array
12; CHECK: function buffer_ssp
13; CHECK-SAME: a stack allocated buffer or struct containing a buffer
14; CHECK: function struct_ssp
15; CHECK-SAME: a stack allocated buffer or struct containing a buffer
16; CHECK: function address_ssp
17; CHECK-SAME: the address of a local variable being taken
18; CHECK: function multiple_ssp
19; CHECK-SAME: a function attribute or command-line switch
20; CHECK: function multiple_ssp
21; CHECK-SAME: a stack allocated buffer or struct containing a buffer
22; CHECK: function multiple_ssp
23; CHECK-SAME: a stack allocated buffer or struct containing a buffer
24; CHECK: function multiple_ssp
25; CHECK-SAME: the address of a local variable being taken
26; CHECK: function multiple_ssp
27; CHECK-SAME: a call to alloca or use of a variable length array
28
29; Check that no remark is emitted when the switch is not specified.
David Bozier3246aec2017-02-28 17:25:38 +000030; RUN: llc %s -mtriple=x86_64-unknown-unknown -o /dev/null 2>&1 | FileCheck %s -check-prefix=NOREMARK -allow-empty
David Bozier51599682017-02-28 16:02:37 +000031; NOREMARK-NOT: ssp
32
33define void @nossp() ssp {
34 ret void
35}
36
37define void @attribute_ssp() sspreq {
38 ret void
39}
40
41define void @alloca_fixed_small_nossp() ssp {
42 %1 = alloca i8, i64 2, align 16
43 ret void
44}
45
46define void @alloca_fixed_small_ssp() sspstrong {
47 %1 = alloca i8, i64 2, align 16
48 ret void
49}
50
51define void @alloca_fixed_large_ssp() ssp {
52 %1 = alloca i8, i64 64, align 16
53 ret void
54}
55
56define void @alloca_variable_ssp(i64 %x) ssp {
57 %1 = alloca i8, i64 %x, align 16
58 ret void
59}
60
61define void @buffer_ssp() sspstrong {
62 %x = alloca [64 x i32], align 16
63 ret void
64}
65
66%struct.X = type { [64 x i32] }
67define void @struct_ssp() sspstrong {
68 %x = alloca %struct.X, align 4
69 ret void
70}
71
72define void @address_ssp() sspstrong {
73entry:
74 %x = alloca i32, align 4
75 %y = alloca i32*, align 8
76 store i32 32, i32* %x, align 4
77 store i32* %x, i32** %y, align 8
78 ret void
79}
80
81define void @multiple_ssp() sspreq {
82entry:
83 %x = alloca %struct.X, align 4
84 %y = alloca [64 x i32], align 16
85 %a = alloca i32, align 4
86 %b = alloca i32*, align 8
87 %0 = alloca i8, i64 2, align 16
88 store i32 32, i32* %a, align 4
89 store i32* %a, i32** %b, align 8
90 ret void
91}