[LoopUnrollAndJam] Changed safety checks to consider more than 2-levels
authorWhitney Tsang <whitneyt@ca.ibm.com>
Wed, 6 May 2020 21:42:47 +0000 (21:42 +0000)
committerWhitney Tsang <whitneyt@ca.ibm.com>
Wed, 6 May 2020 21:47:44 +0000 (21:47 +0000)
commit0a52401ad68b084e52e535541ebff1e9cb6d3869
treec24e3e9d94d0ea272e2ed1d9d6d5c376081f8e07
parent314f99e7d42ded663386190a54b5831dc4a6f3c1
[LoopUnrollAndJam] Changed safety checks to consider more than 2-levels
loop nest.

Summary: As discussed in https://reviews.llvm.org/D73129.

Example
Before unroll and jam:

for
  A
  for
    B
    for
      C
    D
  E
After unroll and jam (currently):

for
  A
  A'
  for
    B
    for
      C
    D
    B'
    for
      C'
    D'
  E
  E'
After unroll and jam (Ideal):

for
  A
  A'
  for
    B
    B'
    for
      C
      C'
    D
    D'
  E
  E'
This is the first patch to change unroll and jam to work in the ideal
way.
This patch change the safety checks needed to make sure is safe to
unroll and jam in the ideal way.

Reviewer: dmgreen, jdoerfert, Meinersbur, kbarton, bmahjour, etiotto
Reviewed By: Meinersbur
Subscribers: fhahn, hiraditya, zzheng, llvm-commits, anhtuyen, prithayan
Tag: LLVM
Differential Revision: https://reviews.llvm.org/D76132
llvm/include/llvm/Transforms/Utils/UnrollLoop.h
llvm/lib/Transforms/Scalar/LoopUnrollAndJamPass.cpp
llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp
llvm/test/Transforms/LoopUnrollAndJam/dependencies.ll
llvm/test/Transforms/LoopUnrollAndJam/dependencies_multidims.ll [new file with mode: 0644]