]> granicus.if.org Git - clang/commitdiff
Add testcase from bug 41079
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Sun, 17 Mar 2019 23:16:31 +0000 (23:16 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Sun, 17 Mar 2019 23:16:31 +0000 (23:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@356354 91177308-0d34-0410-b5e6-96231b3b80d8

test/CodeGen/builtin-expect.c

index 2d4970021732b6b358fcf2614901de9845385a2f..d0dce9b4b92bfd8f2ab08bfd7fe2d3c851d4cdcc 100644 (file)
@@ -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;
+}