summaryrefslogtreecommitdiff
path: root/test/CodeGen/Generic
diff options
context:
space:
mode:
authorRong Xu <xur@google.com>2017-11-14 21:44:09 +0000
committerRong Xu <xur@google.com>2017-11-14 21:44:09 +0000
commit68761036ca36383712767b9ee969fae2df7f58b8 (patch)
treef6d3d31b4a8f41efb55a66e7e59ef0da0e199cfb /test/CodeGen/Generic
parentbd3b99d54291d7c2be31804ce8ffc8c1e9aab062 (diff)
[CodeGen] Peel off the dominant case in switch statement in lowering
This patch peels off the top case in switch statement into a branch if the probability exceeds a threshold. This will help the branch prediction and avoids the extra compares when lowering into chain of branches. Differential Revision: http://reviews.llvm.org/D39262 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318202 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/Generic')
-rw-r--r--test/CodeGen/Generic/MachineBranchProb.ll9
1 files changed, 6 insertions, 3 deletions
diff --git a/test/CodeGen/Generic/MachineBranchProb.ll b/test/CodeGen/Generic/MachineBranchProb.ll
index 8207fa8ce0f..75e9a191e3d 100644
--- a/test/CodeGen/Generic/MachineBranchProb.ll
+++ b/test/CodeGen/Generic/MachineBranchProb.ll
@@ -19,12 +19,15 @@ entry:
i64 1, label %sw.bb
i64 4, label %sw.bb
i64 5, label %sw.bb1
+ i64 15, label %sw.bb
], !prof !0
; CHECK: BB#0: derived from LLVM BB %entry
-; CHECK: Successors according to CFG: BB#2({{[0-9a-fx/= ]+}}75.29%) BB#4({{[0-9a-fx/= ]+}}24.71%)
+; CHECK: Successors according to CFG: BB#1({{[0-9a-fx/= ]+}}92.17%) BB#4({{[0-9a-fx/= ]+}}7.83%)
; CHECK: BB#4: derived from LLVM BB %entry
-; CHECK: Successors according to CFG: BB#1({{[0-9a-fx/= ]+}}47.62%) BB#5({{[0-9a-fx/= ]+}}52.38%)
+; CHECK: Successors according to CFG: BB#2({{[0-9a-fx/= ]+}}75.29%) BB#5({{[0-9a-fx/= ]+}}24.71%)
; CHECK: BB#5: derived from LLVM BB %entry
+; CHECK: Successors according to CFG: BB#1({{[0-9a-fx/= ]+}}47.62%) BB#6({{[0-9a-fx/= ]+}}52.38%)
+; CHECK: BB#6: derived from LLVM BB %entry
; CHECK: Successors according to CFG: BB#1({{[0-9a-fx/= ]+}}36.36%) BB#3({{[0-9a-fx/= ]+}}63.64%)
sw.bb:
@@ -40,7 +43,7 @@ return:
ret i32 %retval.0
}
-!0 = !{!"branch_weights", i32 7, i32 6, i32 4, i32 4, i32 64}
+!0 = !{!"branch_weights", i32 7, i32 6, i32 4, i32 4, i32 64, i21 1000}
declare void @g(i32)