aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2019-03-17 23:16:31 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2019-03-17 23:16:31 +0000
commit22c3cb719e409e4982af795deca2f25d0594ecc9 (patch)
tree06e9681f8481f4bf7a522c974c1088235041c133 /test/CodeGen
parent886a8403b9e9828aefc76b8d7c8187210dd121d6 (diff)
Add testcase from bug 41079
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@356354 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen')
-rw-r--r--test/CodeGen/builtin-expect.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/CodeGen/builtin-expect.c b/test/CodeGen/builtin-expect.c
index 2d49700217..d0dce9b4b9 100644
--- a/test/CodeGen/builtin-expect.c
+++ b/test/CodeGen/builtin-expect.c
@@ -78,3 +78,20 @@ int switch_cond(int x) {
return 0;
}
+int variable_expected(int stuff) {
+// ALL-LABEL: define i32 @variable_expected(
+// O1: call i64 @llvm.expect.i64(i64 {{%.*}}, i64 {{%.*}})
+// O0-NOT: @llvm.expect
+
+ int res = 0;
+
+ switch (__builtin_expect(stuff, stuff)) {
+ case 0:
+ res = 1;
+ break;
+ default:
+ break;
+ }
+
+ return res;
+}