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

Anna Thomas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 19 18:23:35 PDT 2018


anna created this revision.
anna added reviewers: apilipenko, skatkov, mkazantsev, reames.

LoopPredication is not profitable when the loop is known to always exit
through some block other than the latch block.
A coarse grained latch check can cause loop predication to predicate the
loop, making the guard invariant out of the loop and always
unconditionally deoptimize. However, the guard may never fail within the
loop because dynamically, it always exits earlier through some other block and never through
the latch block.
We teach LP about this using BranchProfileInfo pass.

This methodology was chosen instead of adding metadata to prevent loop
predication: https://reviews.llvm.org/D44535


Repository:
  rL LLVM

https://reviews.llvm.org/D44667

Files:
  lib/Transforms/Scalar/LoopPredication.cpp
  test/Transforms/LoopPredication/profitability.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44667.139065.patch
Type: text/x-patch
Size: 10703 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180320/75cb938a/attachment.bin>


More information about the llvm-commits mailing list