[llvm-dev] [NFC] Restructuring LoopRoration.cpp to create Loop Rotation Pass with Loop Rotation Utility Interface

Lin, Jin via llvm-dev llvm-dev at lists.llvm.org
Sat Mar 17 14:25:41 PDT 2018


NFC: Restructuring LoopRoration.cpp to create Loop Rotation Pass with Loop Rotation Utility Interface
=============================================================================

Why this NFC change?
=================
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.


Change Made
==========
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.

========
Summary:
========
Provide an interface for loop rotation so that it can be called on demand. The change is simple and straightforward, patch is uploaded with this NFC for code review.

https://reviews.llvm.org/D44595

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180317/0ec54373/attachment.html>


More information about the llvm-dev mailing list