Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGen / stack-clash-protection.c
blob67571f5cdb2c14c3bf92efe60a6be4a47e297a8d
1 // Check the correct function attributes are generated
2 // RUN: %clang_cc1 -triple x86_64-linux -O0 -S -emit-llvm -o- %s -fstack-clash-protection | FileCheck %s
3 // RUN: %clang_cc1 -triple s390x-linux-gnu -O0 -S -emit-llvm -o- %s -fstack-clash-protection | FileCheck %s
4 // RUN: %clang_cc1 -triple powerpc64le-linux-gnu -O0 -S -emit-llvm -o- %s -fstack-clash-protection | FileCheck %s
5 // RUN: %clang_cc1 -triple powerpc64-linux-gnu -O0 -S -emit-llvm -o- %s -fstack-clash-protection | FileCheck %s
7 // CHECK: define{{.*}} void @large_stack() #[[A:.*]] {
8 void large_stack(void) {
9 volatile int stack[20000], i;
10 for (i = 0; i < sizeof(stack) / sizeof(int); ++i)
11 stack[i] = i;
14 // CHECK: define{{.*}} void @vla({{.*}}) #[[A:.*]] {
15 void vla(int n) {
16 volatile int vla[n];
17 __builtin_memset(&vla[0], 0, 1);
20 // CHECK: define{{.*}} void @builtin_alloca({{.*}}) #[[A:.*]] {
21 void builtin_alloca(int n) {
22 volatile void *mem = __builtin_alloca(n);
25 // CHECK: attributes #[[A]] = {{.*}} "probe-stack"="inline-asm"