3 Commits

Author SHA1 Message Date
David Green
a9bfe02006 [LoopRotate] Rotate loops with loop exiting latches
If a loop has a loop exiting latch, it can be profitable
to rotate the loop if it leads to the simplification of
a phi node. Perform rotation in these cases even if loop
rotate itself didnt simplify the loop to get there.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328933 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-01 12:48:24 +00:00
David Blaikie
96dbd9b711 Remove unused headers to fix layering
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328840 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-29 22:31:39 +00:00
David Green
14d04397ce [LoopRotate] Restructuring LoopRotation.cpp to create Loop Rotation Pass with Loop Rotation Utility Interface
The existing LoopRotation.cpp is implemented as one of loop passes instead of
being a utility. The user cannot easily perform the loop rotation selectively
(or on demand) under different optimization level. For example, the loop
rotation is needed as part of the logic to convert a loop into a loop with
bottom test for a transformation. If the loop rotation is simply added as a
loop pass before the transformation, the pass is skipped if it is compiled at
–O0 or if it is explicitly disabled by the user, causing the compiler to
generate incorrect code. Furthermore, as a loop pass it will rotate all loops
instead of just the relevant loops.

We provide a utility interface for the loop rotation so that the loop rotation
can be called on demand. The changeset is as follows:

- Create a new file lib/Transforms/Utils/LoopRotationUtils.cpp and move the main
  implementation of class LoopRotate into this file.
- Create a new file llvm/include/Transform/Utils/LoopRotationUtils.h with the
  interface LoopRotation(...).
- Original LoopRotation.cpp is changed to use the utility function LoopRotation
  in LoopRotationUtils.cpp. This is done in the same way community did for
  mem-to-reg implementation.

Patch by Jin Lin!

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328766 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-29 08:48:15 +00:00