[PATCH] D15519: Replace weights by probabilities in BPI.
David Li via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 21 22:24:23 PST 2015
davidxl added inline comments.
================
Comment at: lib/Analysis/BranchProbabilityInfo.cpp:349
@@ +348,3 @@
+ SmallVector<BranchProbability, 4> Probs(3, BranchProbability::getZero());
+ if (!BackEdges.empty())
+ Probs[0] = BranchProbability(LBH_TAKEN_WEIGHT,
----------------
Ok, I now see the normalization is done before prob assignment. However I think we can get rid of the normalization completely by computing the right denorm value in the first place. Say the number of back edges is B, number of In edges is I, and number of exiting edges are E, the denorm is
D = (B? TAKEN_WEIGHT: 0) + (I ? TAKEN_WEIGHT : 0) + (E ? NON_TAKEN_WEIGHT : 0)
So a backedge prob (if exists) is:
Prob(backedge) = TAKEN_WEIGHT/(D*B)
http://reviews.llvm.org/D15519
More information about the llvm-commits
mailing list