[PATCH] D22630: Loop rotation
Aditya Kumar via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 19 13:54:57 PDT 2016
hiraditya added a comment.
In https://reviews.llvm.org/D22630#573495, @mzolotukhin wrote:
> > For several loops, after rotation, the header will be non-exiting which is checked already. But that is not true for all rotated loops.
> > Is there a way to find out if an instruction/basic-block was alrady in the loop earlier.
> I'd suggest not rotating a loop if its latch is already exiting (instead of looking at the header) and try to rotate otherwise. If we succeeded, then the latch will become exiting, and we won't rotate this loop next time.
> If a loop has several exits and for some reason we want to "swap" them, then we definitely need a heuristic to determine when we might want to do this. But I think it would be a very rare occasion, so we can probably not care about it for now.
With your suggestion, the folowing checks fail:
LLVM :: Transforms/GVNHoist/pr29031.ll
LLVM :: Transforms/LoopRotate/loop-rotate-before-latch.ll
LLVM :: Transforms/LoopRotate/multiple-exits.ll
LLVM :: Transforms/LoopRotate/pr7447.ll
Essentially, if the header and latch both are exiting, the loop will not rotate (as per your suggestion).
More information about the llvm-commits