[PATCH] D75013: [LoopTerminology] Rotated Loops

Stefanos Baziotis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 10 07:32:21 PDT 2020


baziotis marked an inline comment as done.
baziotis added inline comments.


================
Comment at: llvm/docs/LoopTerminology.rst:392
+    } while (i < n);
+  }
----------------
Meinersbur wrote:
> baziotis wrote:
> > I should make clear here that such movement of code does not happen from `-loop-rotate` (but e.g. LICM). Although we should be careful on the wording because LoopRotate //does// [[ https://github.com/llvm/llvm-project/blob/master/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp#L397 | move some code  ]]. As matter of fact though, I don't understand this: https://godbolt.org/z/hgYhHX
> > `%invcond` doesn't write to / read from memory, has invariant operands, is not a terminator and is not debuginfo intrinsic.
> > So, I don't get why it isn't moved outside, I'll take a look tomorrow.
> > I should make clear here that such movement of code does not happen from -loop-rotate 
> 
> Yes, that would be good.
> 
> > because LoopRotate does move some code.
> 
> good catch!
> 
> > %invcond doesn't write to / read from memory, has invariant operands, is not a terminator and is not debuginfo intrinsic.
> 
> The current implementation is limited to only look loop header. If moving %invconv to the header, we get: https://godbolt.org/z/hmodWG
> The current implementation is limited to only look loop header. If moving %invconv to the header, we get: https://godbolt.org/z/hmodWG

Oh yes, I forgot this:
`BasicBlock::iterator I = OrigHeader->begin(), E = OrigHeader->end();`

And actually this is an interesting example because the loop is simplified pre-loop-rotate and so the instructions are moved to the preheader of the original. Then apparently loop-rotate breaks the canonical form, loop-simplify is called again and so a different preheader is created.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75013/new/

https://reviews.llvm.org/D75013





More information about the llvm-commits mailing list