[PATCH] D30631: [BPI] Use metadata info before any other heuristics
Serguei Katkov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 5 23:09:10 PST 2017
skatkov updated this revision to Diff 90650.
skatkov edited the summary of this revision.
skatkov added a comment.
Actually I've updated a test like Vedant suggested. I like it more.
https://reviews.llvm.org/D30631
Files:
lib/Analysis/BranchProbabilityInfo.cpp
test/Analysis/BranchProbabilityInfo/deopt-intrinsic.ll
Index: test/Analysis/BranchProbabilityInfo/deopt-intrinsic.ll
===================================================================
--- test/Analysis/BranchProbabilityInfo/deopt-intrinsic.ll
+++ test/Analysis/BranchProbabilityInfo/deopt-intrinsic.ll
@@ -19,3 +19,22 @@
exit:
ret i32 %b
}
+
+define i32 @test2(i32 %a, i32 %b) {
+; CHECK-LABEL: Printing analysis {{.*}} for function 'test2':
+entry:
+ %cond = icmp eq i32 %a, 42
+ br i1 %cond, label %exit, label %deopt, !prof !0
+
+; CHECK: edge entry -> exit probability is 0x00000000 / 0x80000000 = 0.00%
+; CHECK: edge entry -> deopt probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge]
+
+deopt:
+ %rval = call i32(...) @llvm.experimental.deoptimize.i32() [ "deopt"() ]
+ ret i32 %rval
+
+exit:
+ ret i32 %b
+}
+
+!0 = !{!"branch_weights", i32 0, i32 1}
Index: lib/Analysis/BranchProbabilityInfo.cpp
===================================================================
--- lib/Analysis/BranchProbabilityInfo.cpp
+++ lib/Analysis/BranchProbabilityInfo.cpp
@@ -671,10 +671,10 @@
// the successors of a block iteratively.
for (auto BB : post_order(&F.getEntryBlock())) {
DEBUG(dbgs() << "Computing probabilities for " << BB->getName() << "\n");
- if (calcUnreachableHeuristics(BB))
- continue;
if (calcMetadataWeights(BB))
continue;
+ if (calcUnreachableHeuristics(BB))
+ continue;
if (calcColdCallHeuristics(BB))
continue;
if (calcLoopBranchHeuristics(BB, LI))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30631.90650.patch
Type: text/x-patch
Size: 1484 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170306/8f6d054d/attachment.bin>
More information about the llvm-commits
mailing list