summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen
diff options
context:
space:
mode:
authorDavid Chisnall <csdavec@swan.ac.uk>2012-01-06 12:20:19 +0000
committerDavid Chisnall <csdavec@swan.ac.uk>2012-01-06 12:20:19 +0000
commit9217435a335eb78b141d57f5d7bb1bc14028742d (patch)
tree1b2035c6fa0059755ce0020f064bb1ce0d1c5368 /clang/test/CodeGen
parentd8e2572909508aad6c9c2d730809e0de226513b3 (diff)
downloadbcm5719-llvm-9217435a335eb78b141d57f5d7bb1bc14028742d.tar.gz
bcm5719-llvm-9217435a335eb78b141d57f5d7bb1bc14028742d.zip
If we are compiling with -fno-builtin then don't do constant folding of
builtins. This fixes PR11711. llvm-svn: 147655
Diffstat (limited to 'clang/test/CodeGen')
-rw-r--r--clang/test/CodeGen/no-builtin.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/CodeGen/no-builtin.c b/clang/test/CodeGen/no-builtin.c
new file mode 100644
index 00000000000..ff1c1924817
--- /dev/null
+++ b/clang/test/CodeGen/no-builtin.c
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fno-builtin -emit-llvm %s -o - | FileCheck %s
+//
+// Check that -fno-builtin prevents us from constant-folding through builtins
+// (PR11711)
+
+double
+cos(double x)
+{
+ printf("ok\n");
+ exit(0);
+}
+
+int
+main(int argc, char *argv[])
+{
+ cos(1); // CHECK: cos
+ printf("not ok\n");
+ abort();
+}
+
OpenPOWER on IntegriCloud