[PATCH] D44595: Restructuring LoopRoration.cpp to create Loop Rotation Pass with Loop Rotation Utility Interface

Jin Lin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 16 17:40:52 PDT 2018


jinlin created this revision.
jinlin added a reviewer: DavidKreitzer.
Herald added subscribers: llvm-commits, mgorny.

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:

1. Create a new file lib/Transforms/Utils/LoopRotationUtils.cpp and move the main implementation of class LoopRotate into this file.
2. Create a new file llvm/include/Transform/Utils/LoopRotationUtils.h with the interface LoopRotation(…).
3. 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.


Repository:
  rL LLVM

https://reviews.llvm.org/D44595

Files:
  include/llvm/Transforms/Utils/LoopRotationUtils.h
  lib/Transforms/Scalar/LoopRotation.cpp
  lib/Transforms/Utils/CMakeLists.txt
  lib/Transforms/Utils/LoopRotationUtils.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44595.138802.patch
Type: text/x-patch
Size: 51307 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180317/cb1fffb6/attachment-0001.bin>


More information about the llvm-commits mailing list