[PATCH] D32124: [BPI] Ignore tail while distributing the remaining probability from unreachanble

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 10 21:43:42 PDT 2017


reames added inline comments.


================
Comment at: lib/Analysis/BranchProbabilityInfo.cpp:333
       BranchProbability PerEdge = ToDistribute / ReachableIdxs.size();
-      for (auto i : ReachableIdxs) {
+      for (auto i : ReachableIdxs)
         BP[i] += PerEdge;
----------------
reames wrote:
> I would suggest leaving the decrement in the loop and asserting after the loop that the remainder is less than the number of edges.  A comment stating that we explicitly drop the remainder to be consistent with other code seems called for as well.
Actually, don't bother with this.  The assert would follow trivially from the code just above it, that's fine.  Thus, LGTM w/out comments.  :)


https://reviews.llvm.org/D32124





More information about the llvm-commits mailing list