[PATCH] D67367: [LoopInterchange] Properly move condition, induction increment and ops to latch.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 9 13:15:05 PDT 2019


fhahn created this revision.
fhahn added reviewers: efriedma, mcrosier.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

Currently we only rely on the induction increment to come before the
condition to ensure the required instructions get moved to the new
latch.

This patch duplicates and moves the required instructions to the
newly created latch. We move the condition to the end of the new block,
then process its operands. We stop at operands that are defined
outside the loop, or are the induction PHI.

We duplicate the instructions and update the uses in the moved
instructions, to ensure other users remain intact. See the added
test2 for such an example.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D67367

Files:
  llvm/lib/Transforms/Scalar/LoopInterchange.cpp
  llvm/test/Transforms/LoopInterchange/pr43176-move-to-new-latch.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67367.219418.patch
Type: text/x-patch
Size: 10220 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190909/200311ee/attachment.bin>


More information about the llvm-commits mailing list