brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.1 KiB · cbd986a Raw
104 lines · plain
1; RUN: llc %s -mtriple=x86_64-unknown-unknown -pass-remarks=stack-protector -o /dev/null 2>&1 | FileCheck %s2; CHECK-NOT: nossp3; CHECK: function attribute_ssp4; CHECK-SAME: a function attribute or command-line switch5; CHECK-NOT: alloca_fixed_small_nossp6; CHECK: function alloca_fixed_small_ssp7; CHECK-SAME: a call to alloca or use of a variable length array8; CHECK: function alloca_fixed_large_ssp9; CHECK-SAME: a call to alloca or use of a variable length array10; CHECK: function alloca_variable_ssp11; CHECK-SAME: a call to alloca or use of a variable length array12; CHECK: function buffer_ssp13; CHECK-SAME: a stack allocated buffer or struct containing a buffer14; CHECK: function struct_ssp15; CHECK-SAME: a stack allocated buffer or struct containing a buffer16; CHECK: function address_ssp17; CHECK-SAME: the address of a local variable being taken18; CHECK: function multiple_ssp19; CHECK-SAME: a function attribute or command-line switch20; CHECK: function multiple_ssp21; CHECK-SAME: a stack allocated buffer or struct containing a buffer22; CHECK: function multiple_ssp23; CHECK-SAME: a stack allocated buffer or struct containing a buffer24; CHECK: function multiple_ssp25; CHECK-SAME: the address of a local variable being taken26; CHECK: function multiple_ssp27; CHECK-SAME: a call to alloca or use of a variable length array28 29; Check that no remark is emitted when the switch is not specified.30; RUN: llc %s -mtriple=x86_64-unknown-unknown -o /dev/null 2>&1 | FileCheck %s -check-prefix=NOREMARK -allow-empty31; NOREMARK-NOT: ssp32 33; RUN: llc %s -mtriple=x86_64-unknown-unknown -o /dev/null -pass-remarks-output=%t.yaml34; RUN: cat %t.yaml | FileCheck %s -check-prefix=YAML35; YAML:      --- !Passed36; YAML-NEXT: Pass:            stack-protector37; YAML-NEXT: Name:            StackProtectorRequested38; YAML-NEXT: Function:        attribute_ssp39; YAML-NEXT: Args:40; YAML-NEXT:   - String:          'Stack protection applied to function '41; YAML-NEXT:   - Function:        attribute_ssp42; YAML-NEXT:   - String:          ' due to a function attribute or command-line switch'43; YAML-NEXT: ...44 45define void @nossp() ssp {46  ret void47}48 49define void @attribute_ssp() sspreq {50  ret void51}52 53define void @alloca_fixed_small_nossp() ssp {54  %1 = alloca i8, i64 2, align 1655  ret void56}57 58define void @alloca_fixed_small_ssp() sspstrong {59  %1 = alloca i8, i64 2, align 1660  ret void61}62 63define void @alloca_fixed_large_ssp() ssp {64  %1 = alloca i8, i64 64, align 1665  ret void66}67 68define void @alloca_variable_ssp(i64 %x) ssp {69  %1 = alloca i8, i64 %x, align 1670  ret void71}72 73define void @buffer_ssp() sspstrong {74  %x = alloca [64 x i32], align 1675  ret void76}77 78%struct.X = type { [64 x i32] }79define void @struct_ssp() sspstrong {80  %x = alloca %struct.X, align 481  ret void82}83 84define void @address_ssp() sspstrong {85entry:86  %x = alloca i32, align 487  %y = alloca ptr, align 888  store i32 32, ptr %x, align 489  store ptr %x, ptr %y, align 890  ret void91}92 93define void @multiple_ssp() sspreq {94entry:95  %x = alloca %struct.X, align 496  %y = alloca [64 x i32], align 1697  %a = alloca i32, align 498  %b = alloca ptr, align 899  %0 = alloca i8, i64 2, align 16100  store i32 32, ptr %a, align 4101  store ptr %a, ptr %b, align 8102  ret void103}104