summaryrefslogtreecommitdiff
path: root/test/CodeGen/builtin-expect.c
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-05-27 18:47:56 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-05-27 18:47:56 +0000
commit5e20cdd81c44a443562a09007668ffdf76c455af (patch)
treedbbd4047878da71c1a706e26ce05b4e7791b14cc /test/CodeGen/builtin-expect.c
parentd5f23b0b7528b5c3caed1ba14f897cc4aaa9e3c3 (diff)
Notes
Diffstat (limited to 'test/CodeGen/builtin-expect.c')
-rw-r--r--test/CodeGen/builtin-expect.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/test/CodeGen/builtin-expect.c b/test/CodeGen/builtin-expect.c
index 664c6b6a470e..884110cbe905 100644
--- a/test/CodeGen/builtin-expect.c
+++ b/test/CodeGen/builtin-expect.c
@@ -1,10 +1,14 @@
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -O0 | FileCheck %s --check-prefix=CHECK_O0
int x;
int y(void);
void foo();
void FUNC() {
+// CHECK-LABEL: define void @FUNC()
// CHECK: [[call:%.*]] = call i32 @y
+// CHECK_O0: [[call:%.*]] = call i32 @y
+// CHECK_O0-NOT: call i64 @llvm.expect
if (__builtin_expect (x, y()))
foo ();
}
@@ -17,21 +21,25 @@ int main() {
(void) __builtin_expect((isigprocmask(), 0), bar());
}
+// CHECK-LABEL: define i32 @main()
// CHECK: call void @isigprocmask()
-// CHECK: [[C:%.*]] = call i64 (...)* @bar()
+// CHECK: [[C:%.*]] = call i64 (...) @bar()
+// CHECK_O0: call void @isigprocmask()
+// CHECK_O0: [[C:%.*]] = call i64 (...) @bar()
+// CHECK_O0-NOT: call i64 @llvm.expect
-// CHECK: @test1
+// CHECK-LABEL: define i32 @test1
int test1(int x) {
-// CHECK: @llvm.expect
+// CHECK_O0-NOT: call i64 @llvm.expect
if (__builtin_expect (x, 1))
return 0;
return x;
}
-// CHECK: @test2
+// CHECK: define i32 @test2
int test2(int x) {
-// CHECK: @llvm.expect
+// CHECK_O0-NOT: call i64 @llvm.expect
switch(__builtin_expect(x, 5)) {
default:
return 0;