[PATCH] D110973: [DA] Handle mismatching loop levels by considering them non-linear

Bardia Mahjour via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 1 13:58:41 PDT 2021


bmahjour created this revision.
Herald added subscribers: javed.absar, hiraditya.
bmahjour requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

To represent various loop levels within a nest, DA implements a special numbering scheme (see comment atop establishNestingLevels). The goal of this numbering scheme appears to be representing each unique loop distinctively by using as little memory as possible. This numbering scheme is simple when the source and destination of the dependence are in the same loop. In such cases the level is simply the depth of the loop in which src and dst reside. When the src and dst are not in the same loop, we could run into the following situation exposed by https://reviews.llvm.org/D71539.

Suppose we have the following loop structure and memory access:

1: L1 <https://reviews.llvm.org/L1>
2:    L2
3:    A[s1] 
4:    L3
5:      A[s2]

Further assume that the subscript of the first access (ie s1) is an LCSSA phi with a single incoming value from L2. With the change in D71539 <https://reviews.llvm.org/D71539>, the SCEV expression for s1 (queried at the scope of L1 <https://reviews.llvm.org/L1> where the access on line 3 occurs) will be an AddRec whose loop is L2.

Since the access A[s1] occurs at a loop depth of 1, but its subscript references a loop at depth 2, the current numbering scheme gets confused and assigns the same level value to both s1 and s2, which further causes classifyPair to incorrectly classify the subscript pair.

This patch proposes a simpler but much more conservative approach than D110972 <https://reviews.llvm.org/D110972>. It simply treats such cases as non-linear and therefore not analyzable.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110973

Files:
  llvm/lib/Analysis/DependenceAnalysis.cpp
  llvm/test/Analysis/DependenceAnalysis/MismatchingNestLevels.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110973.376626.patch
Type: text/x-patch
Size: 5117 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211001/5907bdb3/attachment.bin>


More information about the llvm-commits mailing list