summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/builtin-expect.c
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-07-26 23:11:03 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-07-26 23:11:03 +0000
commit0ebca28f1db9bc83b7a311d389282d401a75d9b9 (patch)
treefdc38bec8794d2a00654a3878bd5eabfe5860ca1 /clang/test/CodeGen/builtin-expect.c
parent76f0cf457c361859f8361b4c9cce2f0a4eabc89a (diff)
downloadbcm5719-llvm-0ebca28f1db9bc83b7a311d389282d401a75d9b9.tar.gz
bcm5719-llvm-0ebca28f1db9bc83b7a311d389282d401a75d9b9.zip
2nd argument of __builtin_expect must be evaluated
if it hs side-effect to matchgcc's behaviour. Addresses radar 8172109. llvm-svn: 109467
Diffstat (limited to 'clang/test/CodeGen/builtin-expect.c')
-rw-r--r--clang/test/CodeGen/builtin-expect.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/test/CodeGen/builtin-expect.c b/clang/test/CodeGen/builtin-expect.c
new file mode 100644
index 00000000000..8f02c4da78a
--- /dev/null
+++ b/clang/test/CodeGen/builtin-expect.c
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+
+int x;
+int y(void);
+void foo();
+void FUNC() {
+// CHECK: [[call:%.*]] = call i32 @y
+ if (__builtin_expect (x, y()))
+ foo ();
+}
+
OpenPOWER on IntegriCloud