Skip to content

Commit b89010a

Browse files
committed
Limit to at least one loop-invariant accesses.
1 parent 4351787 commit b89010a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

llvm/lib/Analysis/LoopAccessAnalysis.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1992,6 +1992,7 @@ getDependenceDistanceStrideAndSize(
19921992

19931993
// Check if we can prove that Sink only accesses memory after Src's end or
19941994
// vice versa.
1995+
if (SE.isLoopInvariant(Src, InnermostLoop) || SE.isLoopInvariant(Sink, InnermostLoop)) {
19951996
const auto &[SrcStart, SrcEnd] =
19961997
getStartAndEndForAccess(InnermostLoop, Src, ATy, PSE);
19971998
const auto &[SinkStart, SinkEnd] =
@@ -2006,6 +2007,7 @@ getDependenceDistanceStrideAndSize(
20062007
if (SE.isKnownPredicate(CmpInst::ICMP_ULE, SinkEnd, SrcStart))
20072008
return MemoryDepChecker::Dependence::NoDep;
20082009
}
2010+
}
20092011

20102012
// Need accesses with constant strides and the same direction. We don't want
20112013
// to vectorize "A[B[i]] += ..." and similar code or pointer arithmetic that

0 commit comments

Comments
 (0)