[all-commits] [llvm/llvm-project] bb8850: [Loop Fusion] Integrate Loop Peeling into Loop Fusion

Sidharth Baveja via All-commits all-commits at lists.llvm.org
Tue Jul 21 09:01:12 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: bb8850d34d601d4edd75fd30c07821c05a726c42
      https://github.com/llvm/llvm-project/commit/bb8850d34d601d4edd75fd30c07821c05a726c42
  Author: Sidharth Baveja <sidharthbav at gmail.com>
  Date:   2020-07-21 (Tue, 21 Jul 2020)

  Changed paths:
    M llvm/lib/Transforms/Scalar/LoopFuse.cpp
    A llvm/test/Transforms/LoopFusion/guarded_peel.ll
    A llvm/test/Transforms/LoopFusion/guarded_unsafeblock_peel.ll
    A llvm/test/Transforms/LoopFusion/nonadjacent_peel.ll
    A llvm/test/Transforms/LoopFusion/peel.ll

  Log Message:
  -----------
  [Loop Fusion] Integrate Loop Peeling into Loop Fusion
Summary:
This patch adds the ability to peel off iterations of the first loop in loop
fusion. This can allow for both loops to have the same trip count, making it
legal for them to be fused together.

Here is a simple scenario peeling can be used in loop fusion:

for (i = 0; i < 10; ++i)
  a[i] = a[i] + 3;
for (j = 1; j < 10; ++j)
  b[j] = b[j] + 5;

Here is we can make use of peeling, and then fuse the two loops together. We can
peel off the 0th iteration of the loop i, and then combine loop i and j for
i = 1 to 10.

a[0] = a[0] +3;
for (i = 1; i < 10; ++i) {
  a[i] = a[i] + 3;
  b[i] = b[i] + 5;
}

Currently peeling with loop fusion is only supported for loops with constant
trip counts and a single exit point. Both unguarded and guarded loops are
supported.

Author: sidbav (Sidharth Baveja)

Reviewers: kbarton, Meinersbur, bkramer, Whitney, skatkov, ashlykov, fhahn, bmahjour

Reviewed By: bmahjour

Subscribers: bmahjour, mgorny, hiraditya, zzheng

Tags: LLVM

Differential Revision: https://reviews.llvm.org/D82927




More information about the All-commits mailing list