[all-commits] [llvm/llvm-project] 36bdc3: [LoopFusion] Move instructions from FC0.Latch to F...

whitneywhtsang via All-commits all-commits at lists.llvm.org
Tue Dec 17 14:10:36 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 36bdc3dc35a509450d52a79225b1509f587236e9
      https://github.com/llvm/llvm-project/commit/36bdc3dc35a509450d52a79225b1509f587236e9
  Author: Whitney Tsang <whitneyt at ca.ibm.com>
  Date:   2019-12-17 (Tue, 17 Dec 2019)

  Changed paths:
    M llvm/include/llvm/Transforms/Utils/CodeMoverUtils.h
    M llvm/lib/Transforms/Scalar/LoopFuse.cpp
    M llvm/lib/Transforms/Utils/CodeMoverUtils.cpp
    M llvm/test/Transforms/LoopFusion/four_loops.ll
    M llvm/test/Transforms/LoopFusion/guarded.ll
    M llvm/test/Transforms/LoopFusion/loop_nest.ll
    M llvm/test/Transforms/LoopFusion/simple.ll

  Log Message:
  -----------
  [LoopFusion] Move instructions from FC0.Latch to FC1.Latch.

Summary: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
latch3:
  br header3, exit3

After Fusion (before this PR):
header1:
  br header2
header2:
  br header2, latch1
latch1:
  br header3
header3:
  br header4
header4:
  br header4, latch3
latch3:
  br header1, exit3

Note that preheader3 is removed during fusion before this PR.
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.

After Fusion (after this PR):
header1:
  br header2
header2:
  br header3
header3:
  br header4
header4:
  br header2, latch3
latch3:
  br header1, exit3

Reviewer: kbarton, jdoerfert, Meinersbur, dmgreen, fhahn, hfinkel,
bmahjour, etiotto
Reviewed By: kbarton, Meinersbur
Subscribers: hiraditya, llvm-commits
Tag: LLVM
Differential Revision: https://reviews.llvm.org/D71165




More information about the All-commits mailing list