[PATCH] D104180: [NFC] [LICM] Create LoopNest Invariant Code Motion (LNICM) pass

toshiki maekawa via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 26 09:47:11 PDT 2021


uint256_t updated this revision to Diff 354693.
uint256_t added a comment.

I am sorry to make you have any unintentional negative feelings. English is not my first language. 
I appreciate all review comments I have gotten. I will try to have the motivation more up front next time.

I am in a GSoC project, where we try to utilize the LoopNest pass. When we investigate what would be benefited from LoopNest, we found that LICM could be a good candidate. 
Unimodular transformations can be hugely simplified by only operating on perfect loop nest. 
Loop interchange is one of the unimodular transformations which is implemented in LLVM, and it is implemented as no intervening code is allowed between loops in a loop nest.
I have included a lit test to illustrate that the current LICM could prevent code to be interchanged, where the proposed LNICM could prevent this problem.
The idea of LICM could still benefit for loop interchange, where a loop nest is imperfect to start with, but could be hoisted to make perfect. I have just modified the lit test to show this.

We have considered not to add a new pass, but add a new parameter to the constructor of the existing LICM, to make it operate like the LNICM when the given argument is true. 
However, we thought adding a new pass to hoist invariance in the scope of loop nest is clearer. 
What do you think @lebedev.ri ?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104180/new/

https://reviews.llvm.org/D104180

Files:
  llvm/include/llvm/Transforms/Scalar/LICM.h
  llvm/include/llvm/Transforms/Utils/LoopUtils.h
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/Scalar/LICM.cpp
  llvm/test/Transforms/LICM/lnicm.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104180.354693.patch
Type: text/x-patch
Size: 10868 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210626/e5935879/attachment.bin>


More information about the llvm-commits mailing list