[PATCH] D30633: [BPI] Reduce the probability of unreachable edge to minimal value greater than 0
Duncan P. N. Exon Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 17 21:07:58 PDT 2017
dexonsmith accepted this revision.
dexonsmith added a comment.
Tests LGTM.
================
Comment at: lib/Analysis/BranchProbabilityInfo.cpp:202-206
+ auto UnreachableProb = UR_TAKEN_PROB;
+ auto ReachableProb =
+ (BranchProbability::getOne() - UR_TAKEN_PROB * UnreachableEdges.size()) /
+ ReachableEdges.size();
----------------
skatkov wrote:
> dexonsmith wrote:
> > This doesn't look to me like it will add up to `BranchProbability::getOne()` in the end. Is that a problem?
> The sum of probabilities might be different than 1 and this consistent with all other heuristics in this file.
> It seems that it was not considered as problem before.
>
> If you think it should be fixed I can come up with a follow-up patch fixing all cases. The question is actually where to add the remainder.
A follow-up patch seems fine. I suggest spreading the remainder among the branches, 1 each until you run out, skipping the unreachable branch.
https://reviews.llvm.org/D30633
More information about the llvm-commits
mailing list