Skip to content

Commit 584158f

Browse files
authored
[LAA] Hoist check for SCEV-uncomputable dist (NFC) (#148841)
Hoist the check for SCEVCouldNotCompute distance into getDependenceDistanceAndSize.
1 parent 8ef1a0e commit 584158f

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

llvm/lib/Analysis/LoopAccessAnalysis.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2085,6 +2085,12 @@ MemoryDepChecker::getDependenceDistanceStrideAndSize(
20852085
if (!isa<SCEVConstant>(Dist))
20862086
FoundNonConstantDistanceDependence |= StrideAPtrInt == StrideBPtrInt;
20872087

2088+
// If distance is a SCEVCouldNotCompute, return Unknown immediately.
2089+
if (isa<SCEVCouldNotCompute>(Dist)) {
2090+
LLVM_DEBUG(dbgs() << "LAA: Uncomputable distance.\n");
2091+
return Dependence::Unknown;
2092+
}
2093+
20882094
return DepDistanceStrideAndSizeInfo(Dist, MaxStride, CommonStride,
20892095
TypeByteSize, AIsWrite, BIsWrite);
20902096
}
@@ -2122,13 +2128,6 @@ MemoryDepChecker::isDependent(const MemAccessInfo &A, unsigned AIdx,
21222128
std::get<DepDistanceStrideAndSizeInfo>(Res);
21232129
bool HasSameSize = TypeByteSize > 0;
21242130

2125-
if (isa<SCEVCouldNotCompute>(Dist)) {
2126-
if (CheckCompletelyBeforeOrAfter())
2127-
return Dependence::NoDep;
2128-
LLVM_DEBUG(dbgs() << "LAA: Dependence because of uncomputable distance.\n");
2129-
return Dependence::Unknown;
2130-
}
2131-
21322131
ScalarEvolution &SE = *PSE.getSE();
21332132
auto &DL = InnermostLoop->getHeader()->getDataLayout();
21342133

0 commit comments

Comments
 (0)