[PATCH] D80544: [LoopUnroll] Simplify latch/header block handling (NFC).

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 26 03:44:54 PDT 2020


fhahn created this revision.
fhahn added reviewers: efriedma, dmgreen, hfinkel, Whitney.
Herald added subscribers: zzheng, hiraditya.
Herald added a project: LLVM.

I think the current code dealing with connecting the unrolled iterations
is a bit more complicated than necessary currently. To connect the
unrolled iterations, we have to update the unrolled latch blocks to
branch to the header of the next unrolled iteration.

We need to do this regardless whether the latch is exiting or not.

Additionally, we try to turn the conditional branch in the exiting block
to an unconditional one. This is an optimization only; alternatively we
could leave the conditional branches in place and rely on other passes
to simplify the conditions.

Logically, this is a separate step from connecting the latches to the
headers, but it is convenient to fold them into the same loop, if the
latch is also exiting. For headers (or other non-latch exiting blocks,
this is done separately).

Hopefully the patch with additional comments makes things a bit clearer.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80544

Files:
  llvm/lib/Transforms/Utils/LoopUnroll.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80544.266150.patch
Type: text/x-patch
Size: 4311 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200526/81a74f34/attachment.bin>


More information about the llvm-commits mailing list