[PATCH] D44667: [LoopPredication] Add profitability check based on BPI

Anna Thomas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 22 04:33:23 PDT 2018


anna marked 2 inline comments as done.
anna added inline comments.


================
Comment at: lib/Transforms/Scalar/LoopPredication.cpp:748
+  for (const auto &ExitEdge : ExitEdges) {
+    BranchProbability ExitingBlockProbability =
+        BPI->getEdgeProbability(ExitEdge.first, ExitEdge.second);
----------------
skatkov wrote:
> anna wrote:
> > skatkov wrote:
> > > You still need to skip latch exiting basic block.
> > you don't need to skip it. The check at line 750 will never be true for latch exit basic block (exitingblock probability > latchExitingBlockProbability). I intentionally ignored checking for latch exiting basic block, it saves us a check for every exiting edge...
> That is true until someone will not set LatchExitProbabilityScale to 0.5.
hmm.. that changes the whole point of the profitability check. It inverts it. Thanks for pointing that out. We need to strengthen against such use cases... 
if `LatchExitProbabilityScale` < 1, we set it to 1. 


Repository:
  rL LLVM

https://reviews.llvm.org/D44667





More information about the llvm-commits mailing list