[PATCH] D28073: Preserve domtree and loop-simplify for runtime unrolling.
Michael Zolotukhin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 10 12:26:40 PST 2017
mzolotukhin accepted this revision.
mzolotukhin added a comment.
This revision is now accepted and ready to land.
Looks good to me, thanks!
Michael
================
Comment at: lib/Transforms/Utils/LoopUnroll.cpp:625-631
+ for (BasicBlock *IterLatch : Latches) {
+ TerminatorInst *Term = IterLatch->getTerminator();
+ if (isa<BranchInst>(Term) && cast<BranchInst>(Term)->isConditional()) {
+ NewIDom = IterLatch;
+ break;
+ }
+ }
----------------
efriedma wrote:
> mzolotukhin wrote:
> > I think we should be able to tell which latch ends with a conditional. It should be either the first one (if all latches end with conditional branches), or the last one. Does it make sense? If so, can we remove this loop?
> The actual conditional is complicated... if we're completely unrolling, it's either the first one or the last one, depending on PreserveCondBr. If we're using a remainder loop, it's always the last one. If we're partially unrolling without a remainder loop, it might not be the first or last one; there's a complicated conditional involving BreakingTrip and TripMultiple. Anyway, this is much more straightforward than trying to duplicate the NeedConditional logic.
Makes sense.
Repository:
rL LLVM
https://reviews.llvm.org/D28073
More information about the llvm-commits
mailing list