aboutsummaryrefslogtreecommitdiff
path: root/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
commite42b8a596886fc98e367c73e54d761446700029e (patch)
tree57f1c5da831a441357ed5929088c9b7b7751c39e /test/CodeGen/builtin-expect.c
parentbe9a5ca062563c374db130c710283590f7a241ed (diff)
2nd argument of __builtin_expect must be evaluated
if it hs side-effect to matchgcc's behaviour. Addresses radar 8172109. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109467 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/builtin-expect.c')
-rw-r--r--test/CodeGen/builtin-expect.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/CodeGen/builtin-expect.c b/test/CodeGen/builtin-expect.c
new file mode 100644
index 0000000000..8f02c4da78
--- /dev/null
+++ b/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 ();
+}
+