[PATCH] D98475: [LoopInterchange] Fix transformation bugs in loop interchange

Congzhe Cao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 11 20:09:22 PST 2021


congzhe created this revision.
congzhe added reviewers: Whitney, fhahn.
congzhe added a project: LLVM.
Herald added a subscriber: hiraditya.
congzhe requested review of this revision.
Herald added a subscriber: llvm-commits.

After loop interchange, the outer loop header should not jump to
the `LoopExit`. Note that the outer loop becomes the inner loop
after interchange. If we branch to `LoopExit` then after interchange
we would jump directly from the (new) inner loop header to `LoopExit`
without executing the rest of outer loop.

This patch modifies adjustLoopBranches() such that the old outer
loop header (which becomes the new inner loop header) jumps to the
old inner loop latch, which becomes the new outer loop latch after
interchange.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98475

Files:
  llvm/lib/Transforms/Scalar/LoopInterchange.cpp
  llvm/test/Transforms/LoopInterchange/lcssa-preheader.ll
  llvm/test/Transforms/LoopInterchange/outer-header-jump-to-inner-latch.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98475.330132.patch
Type: text/x-patch
Size: 13898 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210312/a708ecec/attachment.bin>


More information about the llvm-commits mailing list