Skip to content

Commit b692b23

Browse files
authored
[LAA] Rename var used to retry with RT-checks (NFC) (#147307)
FoundNonConstantDistanceDependence is a misleading name for a variable that determines whether we retry with runtime checks. Rename it.
1 parent 28ca5be commit b692b23

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

llvm/include/llvm/Analysis/LoopAccessAnalysis.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,8 @@ class MemoryDepChecker {
236236

237237
/// In same cases when the dependency check fails we can still
238238
/// vectorize the loop with a dynamic array access check.
239-
bool shouldRetryWithRuntimeCheck() const {
240-
return FoundNonConstantDistanceDependence &&
239+
bool shouldRetryWithRuntimeChecks() const {
240+
return ShouldRetryWithRuntimeChecks &&
241241
Status == VectorizationSafetyStatus::PossiblySafeWithRtChecks;
242242
}
243243

@@ -327,9 +327,9 @@ class MemoryDepChecker {
327327
uint64_t MaxStoreLoadForwardSafeDistanceInBits =
328328
std::numeric_limits<uint64_t>::max();
329329

330-
/// If we see a non-constant dependence distance we can still try to
331-
/// vectorize this loop with runtime checks.
332-
bool FoundNonConstantDistanceDependence = false;
330+
/// Whether we should try to vectorize the loop with runtime checks, if the
331+
/// dependencies are not safe.
332+
bool ShouldRetryWithRuntimeChecks = false;
333333

334334
/// Result of the dependence checks, indicating whether the checked
335335
/// dependences are safe for vectorization, require RT checks or are known to

llvm/lib/Analysis/LoopAccessAnalysis.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -589,11 +589,11 @@ void RuntimePointerChecking::groupChecks(
589589
// dependence. Not grouping the checks for a[i] and a[i + 9000] allows
590590
// us to perform an accurate check in this case.
591591
//
592-
// The above case requires that we have an UnknownDependence between
593-
// accesses to the same underlying object. This cannot happen unless
594-
// FoundNonConstantDistanceDependence is set, and therefore UseDependencies
595-
// is also false. In this case we will use the fallback path and create
596-
// separate checking groups for all pointers.
592+
// In the above case, we have a non-constant distance and an Unknown
593+
// dependence between accesses to the same underlying object, and could retry
594+
// with runtime checks. Therefore UseDependencies is false. In this case we
595+
// will use the fallback path and create separate checking groups for all
596+
// pointers.
597597

598598
// If we don't have the dependency partitions, construct a new
599599
// checking pointer group for each pointer. This is also required
@@ -819,7 +819,7 @@ class AccessAnalysis {
819819
/// perform dependency checking.
820820
///
821821
/// Note that this can later be cleared if we retry memcheck analysis without
822-
/// dependency checking (i.e. FoundNonConstantDistanceDependence).
822+
/// dependency checking (i.e. ShouldRetryWithRuntimeChecks).
823823
bool isDependencyCheckNeeded() const { return !CheckDeps.empty(); }
824824

825825
/// We decided that no dependence analysis would be used. Reset the state.
@@ -896,7 +896,7 @@ class AccessAnalysis {
896896
///
897897
/// Note that, this is different from isDependencyCheckNeeded. When we retry
898898
/// memcheck analysis without dependency checking
899-
/// (i.e. FoundNonConstantDistanceDependence), isDependencyCheckNeeded is
899+
/// (i.e. ShouldRetryWithRuntimeChecks), isDependencyCheckNeeded is
900900
/// cleared while this remains set if we have potentially dependent accesses.
901901
bool IsRTCheckAnalysisNeeded = false;
902902

@@ -2079,11 +2079,10 @@ MemoryDepChecker::getDependenceDistanceStrideAndSize(
20792079
if (StrideAScaled == StrideBScaled)
20802080
CommonStride = StrideAScaled;
20812081

2082-
// TODO: FoundNonConstantDistanceDependence is used as a necessary condition
2083-
// to consider retrying with runtime checks. Historically, we did not set it
2084-
// when (unscaled) strides were different but there is no inherent reason to.
2082+
// TODO: Historically, we didn't retry with runtime checks when (unscaled)
2083+
// strides were different but there is no inherent reason to.
20852084
if (!isa<SCEVConstant>(Dist))
2086-
FoundNonConstantDistanceDependence |= StrideAPtrInt == StrideBPtrInt;
2085+
ShouldRetryWithRuntimeChecks |= StrideAPtrInt == StrideBPtrInt;
20872086

20882087
// If distance is a SCEVCouldNotCompute, return Unknown immediately.
20892088
if (isa<SCEVCouldNotCompute>(Dist)) {
@@ -2712,7 +2711,7 @@ bool LoopAccessInfo::analyzeLoop(AAResults *AA, const LoopInfo *LI,
27122711
DepsAreSafe =
27132712
DepChecker->areDepsSafe(DepCands, Accesses.getDependenciesToCheck());
27142713

2715-
if (!DepsAreSafe && DepChecker->shouldRetryWithRuntimeCheck()) {
2714+
if (!DepsAreSafe && DepChecker->shouldRetryWithRuntimeChecks()) {
27162715
LLVM_DEBUG(dbgs() << "LAA: Retrying with memory checks\n");
27172716

27182717
// Clear the dependency checks. We assume they are not needed.

0 commit comments

Comments
 (0)