[PATCH] D73129: [LoopUnrollAndJam] Correctly update LoopInfo when unroll and jam more than 2-levels loop nests.

Whitney Tsang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 21 12:05:18 PST 2020


Whitney created this revision.
Whitney added reviewers: dmgreen, jdoerfert, Meinersbur, kbarton, bmahjour, etiotto.
Whitney added a project: LLVM.
Herald added subscribers: llvm-commits, zzheng, hiraditya.

Before unroll and jam:

  for i
    for j
      for k
        A[i][j][k] = 0

After unroll and jam loop-i by a factor of 2:

  for i +=2
    for j {
      for k
        A[i][j][k] = 0
      for k'
        A[i+1][j][k] = 0
    }

Notice that there exists a new child loop loop-k' of loop-j, after unroll and jam loop-i by 2. 
This patch correctly update LoopInfo with new loops created during unroll and jamming.

Side discussion:
With the example above, we can see that changing the order of how loops are traverse in a loop nest doesn't actually solve the only one subloop limitation. We need to think of other ways to have more loops able to unroll and jam. One way is try to fuse subloops before giving up. Another way could be unroll and jam the whole loop nest in one attempt, i.e. no need to create the loop-k'. Other ideas are welcome.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73129

Files:
  llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp
  llvm/test/Transforms/LoopUnrollAndJam/loopnest.ll
  llvm/test/Transforms/LoopUnrollAndJam/unroll-and-jam.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73129.239396.patch
Type: text/x-patch
Size: 15881 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200121/fd8c1d9e/attachment.bin>


More information about the llvm-commits mailing list