aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/LoopAccessAnalysis.cpp
diff options
context:
space:
mode:
authorRamkumar Ramachandra <ramkumar.ramachandra@codasip.com>2025-07-16 15:30:53 +0100
committerGitHub <noreply@github.com>2025-07-16 15:30:53 +0100
commit584158f9aeac7df66ca08649b8c082883c66b360 (patch)
tree2736c8a471bd0a567b7fa9a5b3a057f2fc840c02 /llvm/lib/Analysis/LoopAccessAnalysis.cpp
parent8ef1a0ec1fd5663a1d85f9cc84bf6d86eb46980d (diff)
downloadllvm-584158f9aeac7df66ca08649b8c082883c66b360.zip
llvm-584158f9aeac7df66ca08649b8c082883c66b360.tar.gz
llvm-584158f9aeac7df66ca08649b8c082883c66b360.tar.bz2
[LAA] Hoist check for SCEV-uncomputable dist (NFC) (#148841)
Hoist the check for SCEVCouldNotCompute distance into getDependenceDistanceAndSize.
Diffstat (limited to 'llvm/lib/Analysis/LoopAccessAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/LoopAccessAnalysis.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index f8f74157..f3a32d3 100644
--- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -2085,6 +2085,12 @@ MemoryDepChecker::getDependenceDistanceStrideAndSize(
if (!isa<SCEVConstant>(Dist))
FoundNonConstantDistanceDependence |= StrideAPtrInt == StrideBPtrInt;
+ // If distance is a SCEVCouldNotCompute, return Unknown immediately.
+ if (isa<SCEVCouldNotCompute>(Dist)) {
+ LLVM_DEBUG(dbgs() << "LAA: Uncomputable distance.\n");
+ return Dependence::Unknown;
+ }
+
return DepDistanceStrideAndSizeInfo(Dist, MaxStride, CommonStride,
TypeByteSize, AIsWrite, BIsWrite);
}
@@ -2122,13 +2128,6 @@ MemoryDepChecker::isDependent(const MemAccessInfo &A, unsigned AIdx,
std::get<DepDistanceStrideAndSizeInfo>(Res);
bool HasSameSize = TypeByteSize > 0;
- if (isa<SCEVCouldNotCompute>(Dist)) {
- if (CheckCompletelyBeforeOrAfter())
- return Dependence::NoDep;
- LLVM_DEBUG(dbgs() << "LAA: Dependence because of uncomputable distance.\n");
- return Dependence::Unknown;
- }
-
ScalarEvolution &SE = *PSE.getSE();
auto &DL = InnermostLoop->getHeader()->getDataLayout();