[PATCH] D44766: Extend peeling to help invariant motion

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 21 19:17:36 PDT 2018


efriedma added inline comments.


================
Comment at: lib/Transforms/Utils/LoopUnrollPeel.cpp:531
   BasicBlock *Latch = L->getLoopLatch();
-  BasicBlock *Exit = L->getUniqueExitBlock();
+  BasicBlock *Exit = L->getUniqueReachableExitBlock();
 
----------------
evstupac wrote:
> efriedma wrote:
> > This is really hacky.
> > 
> > There really isn't any reason we can't peel loops with multiple exits; it just isn't implemented yet.  Please fix it properly.
> Well. I agree that putting these methods to LoopAnalysis is not good.
> But this is as "hacky" as previous implementation limited to loops with one exit from latch.
> The reason I limit peeling to just unreachable exits case is that these exits have close to 0 frequency. For other multiexit loops it is harder to estimate profitability.
> 
> However you are right and peeling of multiexit loops is doable and (if you feel this could be profitable) I can create a separate patch for this.
> 
If it isn't profitable to unroll multi-exit loops which have more than one likely exit, we can add a check to computePeelCount, rather than canPeel.


Repository:
  rL LLVM

https://reviews.llvm.org/D44766





More information about the llvm-commits mailing list