summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/attr-optnone.c
diff options
context:
space:
mode:
authorPaul Robinson <paul_robinson@playstation.sony.com>2014-03-31 22:29:15 +0000
committerPaul Robinson <paul_robinson@playstation.sony.com>2014-03-31 22:29:15 +0000
commitf067435026123765bcba8094676c813a69d28a88 (patch)
treeb75e5a1886f665e3016bce5a6adc0fc737a38147 /clang/test/CodeGen/attr-optnone.c
parente117992f00c4cf16929b6a65de8eeab15f8942ad (diff)
downloadbcm5719-llvm-f067435026123765bcba8094676c813a69d28a88.tar.gz
bcm5719-llvm-f067435026123765bcba8094676c813a69d28a88.zip
Implement the 'optnone' attribute, which suppresses most optimizations
on a function. llvm-svn: 205255
Diffstat (limited to 'clang/test/CodeGen/attr-optnone.c')
-rw-r--r--clang/test/CodeGen/attr-optnone.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/clang/test/CodeGen/attr-optnone.c b/clang/test/CodeGen/attr-optnone.c
new file mode 100644
index 00000000000..7c4873f8c5f
--- /dev/null
+++ b/clang/test/CodeGen/attr-optnone.c
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -emit-llvm < %s > %t
+// RUN: FileCheck %s --check-prefix=PRESENT < %t
+// RUN: FileCheck %s --check-prefix=ABSENT < %t
+
+__attribute__((always_inline))
+int test2() { return 0; }
+// PRESENT-DAG: @test2{{.*}}[[ATTR2:#[0-9]+]]
+
+__attribute__((optnone)) __attribute__((minsize))
+int test3() { return 0; }
+// PRESENT-DAG: @test3{{.*}}[[ATTR3:#[0-9]+]]
+
+__attribute__((optnone)) __attribute__((cold))
+int test4() { return test2(); }
+// PRESENT-DAG: @test4{{.*}}[[ATTR4:#[0-9]+]]
+// Also check that test2 is inlined into test4 (always_inline still works).
+// PRESENT-DAG-NOT: call i32 @test2
+
+// Check for both noinline and optnone on each optnone function.
+// PRESENT-DAG: attributes [[ATTR3]] = { {{.*}}noinline{{.*}}optnone{{.*}} }
+// PRESENT-DAG: attributes [[ATTR4]] = { {{.*}}noinline{{.*}}optnone{{.*}} }
+
+// Check that no 'optsize' or 'minsize' attributes appear.
+// ABSENT-NOT: optsize
+// ABSENT-NOT: minsize
OpenPOWER on IntegriCloud