[PATCH] D113345: [WIP][BPI] `calcEstimatedHeuristics()`: symmetrically with loop exiting edge, scale loop enter edge weight by trip count

Bin Cheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 6 20:15:52 PDT 2021


bin.cheng added inline comments.


================
Comment at: llvm/lib/Analysis/BranchProbabilityInfo.cpp:850
 
+    if (isLoopEnteringEdge(Edge) &&
+        // Avoid adjustment of ZERO weight since it should remain unchanged.
----------------
Please correct me if I understand the idea incorrectly.
The problem at this point is that we don't know if the entering edge is duplicated from loop exit branch from LoopRotate.  The edge could be from source code or other transformations, in this case, we don't really know the probability taking or skipping the guarded loop.  For example, GCC has a heuristics saying that guarded inner loop in loop nest usually is not likely to be executed. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113345/new/

https://reviews.llvm.org/D113345



More information about the llvm-commits mailing list