[PATCH] D15489: Use getEdgeProbability() instead of getEdgeWeight() in BFI and remove getEdgeWeight() interfaces from MBPI.

Cong Hou via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 14 15:47:09 PST 2015


congh added inline comments.

================
Comment at: include/llvm/Analysis/BlockFrequencyInfoImpl.h:1193
@@ -1194,3 +1192,3 @@
       if (!addToDist(Dist, OuterLoop, Node, getNode(*SI),
-                     BPI->getEdgeWeight(BB, SI)))
+                     BPI->getEdgeProbability(BB, SI).getNumerator()))
         // Irreducible backedge.
----------------
davidxl wrote:
> Can you add a file local wrapper function in this file 
> 
> inline static  uint32_t getEdgeWeight(... ) { return ... getNumerator()...)
> 
> 
This function will have some weird parameters like successor iterator and BPI, I instead created a wrapper convertBranchProbabilityToWeight() to convert BP into weight.

================
Comment at: test/Analysis/BlockFrequencyInfo/bad_input.ll:13
@@ -14,1 +12,3 @@
+; Check that we get 1 and a huge frequency instead of 0,3.
+; CHECK-NEXT: for.body: float = 2147483647.8,
 for.body:
----------------
davidxl wrote:
> What makes this diff?
The weights 0 will be transformed into 1 in BFI so we will get 1 and 3 as the actual weights that are used to calculate frequencies. With this patch the numerators of BP are used as weight so we will get 0 and 1<<31 (representing BP 0% and 100%) as edge weights, which are then transformed into 1 and 1<<31 later.


http://reviews.llvm.org/D15489





More information about the llvm-commits mailing list