[PATCH] D30631: [BPI] Use metadata info before any other heuristics

Serguei Katkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 14 01:15:19 PDT 2017


skatkov added inline comments.


================
Comment at: lib/Analysis/BranchProbabilityInfo.cpp:337
+      BP[i] += PerEdge;
+      ToDistribute -= PerEdge;
+    }
----------------
skatkov wrote:
> chandlerc wrote:
> > Is it better to do this in the loop or to multiply by size and subtract that once? It seems simpler to write the latter way inside the addition below:
> > 
> >   BP[ReachableIdxs[0]] += ToDistribute - (PerEdge * ReachableIdxs.size());
> Will do.
Funny, BranchProbability does not have an multiplication operation by scalar...
I will leave it as is for now and upload one more patch implementing BP[ReachableIdxs[0]] += ToDistribute - (PerEdge * ReachableIdxs.size());

BTW, I guess the compiler should optimize it anyway and move ToDistribute -= PerEdge; out of the loop. But who knows :)


https://reviews.llvm.org/D30631





More information about the llvm-commits mailing list