[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:41:00 PDT 2017


reames accepted this revision.
reames added a comment.
This revision is now accepted and ready to land.

LGTM w/comment addressed.



================
Comment at: lib/Analysis/BranchProbabilityInfo.cpp:333
       BranchProbability PerEdge = ToDistribute / ReachableIdxs.size();
-      for (auto i : ReachableIdxs) {
+      for (auto i : ReachableIdxs)
         BP[i] += PerEdge;
----------------
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.


https://reviews.llvm.org/D32124





More information about the llvm-commits mailing list