Skip to content

[LAA] Rename var used to retry with RT-checks (NFC) #147307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions llvm/include/llvm/Analysis/LoopAccessAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ class MemoryDepChecker {

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

Expand Down Expand Up @@ -327,9 +327,9 @@ class MemoryDepChecker {
uint64_t MaxStoreLoadForwardSafeDistanceInBits =
std::numeric_limits<uint64_t>::max();

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

/// Result of the dependence checks, indicating whether the checked
/// dependences are safe for vectorization, require RT checks or are known to
Expand Down
15 changes: 7 additions & 8 deletions llvm/lib/Analysis/LoopAccessAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ void RuntimePointerChecking::groupChecks(
//
// The above case requires that we have an UnknownDependence between
// accesses to the same underlying object. This cannot happen unless
// FoundNonConstantDistanceDependence is set, and therefore UseDependencies
// ShouldRetryWithRuntimeChecks is set, and therefore UseDependencies
// is also false. In this case we will use the fallback path and create
// separate checking groups for all pointers.

Expand Down Expand Up @@ -819,7 +819,7 @@ class AccessAnalysis {
/// perform dependency checking.
///
/// Note that this can later be cleared if we retry memcheck analysis without
/// dependency checking (i.e. FoundNonConstantDistanceDependence).
/// dependency checking (i.e. ShouldRetryWithRuntimeChecks).
bool isDependencyCheckNeeded() const { return !CheckDeps.empty(); }

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

Expand Down Expand Up @@ -2081,11 +2081,10 @@ MemoryDepChecker::getDependenceDistanceStrideAndSize(
if (StrideAScaled == StrideBScaled)
CommonStride = StrideAScaled;

// 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.
// TODO: Historically, we didn't retry with runtime checks when (unscaled)
// strides were different but there is no inherent reason to.
if (!isa<SCEVConstant>(Dist))
FoundNonConstantDistanceDependence |= StrideAPtrInt == StrideBPtrInt;
ShouldRetryWithRuntimeChecks |= StrideAPtrInt == StrideBPtrInt;

return DepDistanceStrideAndSizeInfo(Dist, MaxStride, CommonStride,
TypeByteSize, AIsWrite, BIsWrite);
Expand Down Expand Up @@ -2700,7 +2699,7 @@ bool LoopAccessInfo::analyzeLoop(AAResults *AA, const LoopInfo *LI,
DepsAreSafe =
DepChecker->areDepsSafe(DepCands, Accesses.getDependenciesToCheck());

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

// Clear the dependency checks. We assume they are not needed.
Expand Down
Loading