[PATCH] D71821: [LoopFusion] Move instructions from FC1.Preheader to FC0.Preheader when proven safe.

Whitney Tsang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 22 16:58:58 PST 2019


Whitney created this revision.
Whitney added reviewers: kbarton, Meinersbur, jdoerfert, dmgreen, fhahn, hfinkel, bmahjour, etiotto.
Whitney added a project: LLVM.
Herald added subscribers: llvm-commits, hiraditya.
Whitney added a parent revision: D71578: [CodeMoverUtils] Improve IsControlFlowEquivalent..

Currently LoopFusion give up when the second loop nest preheader is
not empty. For example:

  for (int i = 0; i < 100; ++i) {}
  x+=1;
  for (int i = 0; i < 100; ++i) {}

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71821

Files:
  llvm/include/llvm/Transforms/Utils/CodeMoverUtils.h
  llvm/lib/Transforms/Scalar/LoopFuse.cpp
  llvm/lib/Transforms/Utils/CodeMoverUtils.cpp
  llvm/test/Transforms/LoopFusion/cannot_fuse.ll
  llvm/test/Transforms/LoopFusion/diagnostics_missed.ll
  llvm/test/Transforms/LoopFusion/guarded.ll
  llvm/test/Transforms/LoopFusion/simple.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71821.235082.patch
Type: text/x-patch
Size: 10549 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191223/38a1235a/attachment.bin>


More information about the llvm-commits mailing list