[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
Mon Nov 8 01:03:32 PST 2021


bin.cheng added inline comments.


================
Comment at: llvm/lib/Analysis/BranchProbabilityInfo.cpp:851
+    if (isLoopEnteringEdge(Edge) && SuccLoopBB.getLoop() &&
+        SuccLoopBB.getLoop()->isRotatedForm() &&
+        // Avoid adjustment of ZERO weight since it should remain unchanged.
----------------
IMHO isRotatedForm check is not enough because it only checks "form".  For example, a user written do-while loop under some irrelevant guard condition.  Is it possible to also check if we are checking on induction variable of SuccLoop?  I guess this covers most cases with minimum false positive.


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