[all-commits] [llvm/llvm-project] 5cf90d: [LoopUnroll] Simplify latch/header block handling ...

Florian Hahn via All-commits all-commits at lists.llvm.org
Tue May 26 13:54:55 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 5cf90d6cf1b811a6693383c487f79d24d5b306bb
      https://github.com/llvm/llvm-project/commit/5cf90d6cf1b811a6693383c487f79d24d5b306bb
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2020-05-26 (Tue, 26 May 2020)

  Changed paths:
    M llvm/lib/Transforms/Utils/LoopUnroll.cpp

  Log Message:
  -----------
  [LoopUnroll] Simplify latch/header block handling (NFC).

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.

Reviewers: efriedma, dmgreen, hfinkel, Whitney

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D80544




More information about the All-commits mailing list