aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/LoopAccessAnalysis.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Analysis/LoopAccessAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/LoopAccessAnalysis.cpp42
1 files changed, 9 insertions, 33 deletions
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index 007ee3c..b6dc5c4 100644
--- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -2081,14 +2081,14 @@ MemoryDepChecker::getDependenceDistanceStrideAndSize(
if (StrideAScaled == StrideBScaled)
CommonStride = StrideAScaled;
- // TODO: Historically, we don't retry with runtime checks unless the
- // (unscaled) strides are the same. Fix this once the condition for runtime
- // checks in isDependent is fixed.
- bool ShouldRetryWithRuntimeCheck = StrideAPtrInt == StrideBPtrInt;
+ // TODO: FoundNonConstantDistanceDependence is used as a necessary condition
+ // to consider retrying with runtime checks. Historically, we did not set it
+ // when (unscaled) strides were different but there is no inherent reason to.
+ if (!isa<SCEVConstant>(Dist))
+ FoundNonConstantDistanceDependence |= StrideAPtrInt == StrideBPtrInt;
return DepDistanceStrideAndSizeInfo(Dist, MaxStride, CommonStride,
- ShouldRetryWithRuntimeCheck, TypeByteSize,
- AIsWrite, BIsWrite);
+ TypeByteSize, AIsWrite, BIsWrite);
}
MemoryDepChecker::Dependence::DepType
@@ -2103,15 +2103,11 @@ MemoryDepChecker::isDependent(const MemAccessInfo &A, unsigned AIdx,
if (std::holds_alternative<Dependence::DepType>(Res))
return std::get<Dependence::DepType>(Res);
- auto &[Dist, MaxStride, CommonStride, ShouldRetryWithRuntimeCheck,
- TypeByteSize, AIsWrite, BIsWrite] =
+ auto &[Dist, MaxStride, CommonStride, TypeByteSize, AIsWrite, BIsWrite] =
std::get<DepDistanceStrideAndSizeInfo>(Res);
bool HasSameSize = TypeByteSize > 0;
if (isa<SCEVCouldNotCompute>(Dist)) {
- // TODO: Relax requirement that there is a common unscaled stride to retry
- // with non-constant distance dependencies.
- FoundNonConstantDistanceDependence |= ShouldRetryWithRuntimeCheck;
LLVM_DEBUG(dbgs() << "LAA: Dependence because of uncomputable distance.\n");
return Dependence::Unknown;
}
@@ -2173,14 +2169,8 @@ MemoryDepChecker::isDependent(const MemAccessInfo &A, unsigned AIdx,
// forward dependency will allow vectorization using any width.
if (IsTrueDataDependence && EnableForwardingConflictDetection) {
- if (!ConstDist) {
- // TODO: FoundNonConstantDistanceDependence is used as a necessary
- // condition to consider retrying with runtime checks. Historically, we
- // did not set it when strides were different but there is no inherent
- // reason to.
- FoundNonConstantDistanceDependence |= ShouldRetryWithRuntimeCheck;
+ if (!ConstDist)
return Dependence::Unknown;
- }
if (!HasSameSize ||
couldPreventStoreLoadForward(ConstDist, TypeByteSize)) {
LLVM_DEBUG(
@@ -2195,22 +2185,8 @@ MemoryDepChecker::isDependent(const MemAccessInfo &A, unsigned AIdx,
int64_t MinDistance = SE.getSignedRangeMin(Dist).getSExtValue();
// Below we only handle strictly positive distances.
- if (MinDistance <= 0) {
- FoundNonConstantDistanceDependence |= ShouldRetryWithRuntimeCheck;
+ if (MinDistance <= 0)
return Dependence::Unknown;
- }
-
- if (!ConstDist) {
- // Previously this case would be treated as Unknown, possibly setting
- // FoundNonConstantDistanceDependence to force re-trying with runtime
- // checks. Until the TODO below is addressed, set it here to preserve
- // original behavior w.r.t. re-trying with runtime checks.
- // TODO: FoundNonConstantDistanceDependence is used as a necessary
- // condition to consider retrying with runtime checks. Historically, we
- // did not set it when strides were different but there is no inherent
- // reason to.
- FoundNonConstantDistanceDependence |= ShouldRetryWithRuntimeCheck;
- }
if (!HasSameSize) {
LLVM_DEBUG(dbgs() << "LAA: ReadWrite-Write positive dependency with "