[PATCH] D73641: [LoopFusion] Move instructions from FC1.GuardBlock to FC0.GuardBlock and from FC0.ExitBlock to FC1.ExitBlock when proven safe.

Whitney Tsang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 29 09:49:13 PST 2020


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.

Currently LoopFusion give up when the second loop nest guard
block or the first loop nest exit block is not empty. For example:

  if (0 < N) {
    for (int i = 0; i < N; ++i) {}
    x+=1;
  }
  y+=1;
  if (0 < N) {
    for (int i = 0; i < N; ++i) {}
  }

The above example should be safe to fuse.
This PR moves instructions in FC1 guard block (e.g. y+=1;) to
FC0 guard block, or instructions in FC0 exit block (e.g. x+=1;) to
FC1 exit block, which then LoopFusion is able to fuse them.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73641

Files:
  llvm/lib/Transforms/Scalar/LoopFuse.cpp
  llvm/test/Transforms/LoopFusion/diagnostics_missed.ll
  llvm/test/Transforms/LoopFusion/guarded.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73641.241203.patch
Type: text/x-patch
Size: 11235 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200129/4cf5e023/attachment.bin>


More information about the llvm-commits mailing list