[PATCH] D33001: [RuntimeUnrolling] Add logic for loops with multiple exit blocks

Anna Thomas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 27 07:33:38 PDT 2017


anna planned changes to this revision.
anna marked an inline comment as done.
anna added a comment.

Changing the code to generate dedicated exits instead of cloning the exit blocks. This would make it simpler to reason about successors to the exit blocks.



================
Comment at: lib/Transforms/Utils/LoopUnrollRuntime.cpp:567
+  // the latch.
+  const SCEV *BECountSC = SE->getExitCount(L, Latch);
   if (isa<SCEVCouldNotCompute>(BECountSC) ||
----------------
anna wrote:
> reames wrote:
> > Can you separate and land this change?  It should be NFC for the old code and if it's not, it'd be good to find out now.
> > 
> > And, reading the comments carefully, I'm not sure this is actually NFC.  Aren't the exit count and the backedge taken count defined differently?  (Consider loop whose header executes once and whose backedge is dynamically dead.)
> > 
> > Also, "guaranteed not to exit" doesn't seem to imply guaranteed to exit on the next iteration.
> Thanks for bringing this up.
> I read the actual SCEV code (comments seem to differ from the code) for `getExitCount` versus `getBackEdgeTakenCount`, and the `getBackEdgeTakenCount` is semantically equivalent to `getExitCount` for all exits in the loop. 
> 
> So, I think this will be an NFC for the old code. 
> 
> 
Submitted separately as NFC. no problems spotted. 


https://reviews.llvm.org/D33001





More information about the llvm-commits mailing list