[PATCH] D71165: [LoopFusion] Move instructions from FC0.Latch to FC1.Latch.

Whitney Tsang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 7 05:28:33 PST 2019


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

This PR move instructions from FC0.Latch bottom up to the beginning of FC1.Latch as long as they are proven safe.

To illustrate why this is beneficial, let's consider the following example:
Before Fusion:

  header1:
    br header2
  header2:
    br header2, latch1
  latch1:
    br header1, preheader3
  preheader3:
    br header3
  header3:
    br header4
  header4:
    br header4
  latch3:
    br header3, exit3

After Fusion:

  header1:
    br header2
  header2:
    br header2, latch1
  latch1:
    br header3
  header3:
    br header4
  header4:
    br header4
  latch3:
    br header1, exit3

Notice that we cannot fuse loop2 with loop4 as there exists block latch1 in between.
This PR move instructions from latch1 to beginning of latch3, and remove block latch1. LoopFusion is now able to fuse loop nest recursively.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71165

Files:
  llvm/lib/Transforms/Scalar/LoopFuse.cpp
  llvm/lib/Transforms/Utils/CodeMoverUtils.cpp
  llvm/test/Transforms/LoopFusion/four_loops.ll
  llvm/test/Transforms/LoopFusion/guarded.ll
  llvm/test/Transforms/LoopFusion/loop_nest.ll
  llvm/test/Transforms/LoopFusion/simple.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71165.232697.patch
Type: text/x-patch
Size: 11010 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191207/71c49e68/attachment.bin>


More information about the llvm-commits mailing list