[LAA] Rename IsRTNeeded to IsRTCheckAnalysisNeeded

The original name was too close to NeedRTCheck which is what the actual
memcheck analysis returns.  This flag, as the new name suggests, is only
used to whether to initiate that analysis.

Also a comment is added to answer one question I had about this code for
a long time.  Namely, how does this flag differ from
isDependencyCheckNeeded since they are seemingly set at the same time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241784 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Adam Nemet 2015-07-09 06:47:18 +00:00
parent e1ef0c07e9
commit ecb6a37111

View File

@ -373,7 +373,8 @@ public:
AccessAnalysis(const DataLayout &Dl, AliasAnalysis *AA, LoopInfo *LI, AccessAnalysis(const DataLayout &Dl, AliasAnalysis *AA, LoopInfo *LI,
MemoryDepChecker::DepCandidates &DA) MemoryDepChecker::DepCandidates &DA)
: DL(Dl), AST(*AA), LI(LI), DepCands(DA), IsRTCheckNeeded(false) {} : DL(Dl), AST(*AA), LI(LI), DepCands(DA),
IsRTCheckAnalysisNeeded(false) {}
/// \brief Register a load and whether it is only read from. /// \brief Register a load and whether it is only read from.
void addLoad(MemoryLocation &Loc, bool IsReadOnly) { void addLoad(MemoryLocation &Loc, bool IsReadOnly) {
@ -405,8 +406,11 @@ public:
processMemAccesses(); processMemAccesses();
} }
bool isRTCheckNeeded() { return IsRTCheckNeeded; } /// \brief Initial processing of memory accesses determined that we need to
/// perform dependency checking.
///
/// Note that this can later be cleared if we retry memcheck analysis without
/// dependency checking (i.e. ShouldRetryWithRuntimeCheck).
bool isDependencyCheckNeeded() { return !CheckDeps.empty(); } bool isDependencyCheckNeeded() { return !CheckDeps.empty(); }
/// We decided that no dependence analysis would be used. Reset the state. /// We decided that no dependence analysis would be used. Reset the state.
@ -446,7 +450,14 @@ private:
/// dependence check. /// dependence check.
MemoryDepChecker::DepCandidates &DepCands; MemoryDepChecker::DepCandidates &DepCands;
bool IsRTCheckNeeded; /// \brief Initial processing of memory accesses determined that we may need
/// to add memchecks. Perform the analysis to determine the necessary checks.
///
/// Note that, this is different from isDependencyCheckNeeded. When we retry
/// memcheck analysis without dependency checking
/// (i.e. ShouldRetryWithRuntimeCheck), isDependencyCheckNeeded is cleared
/// while this remains set if we have potentially dependent accesses.
bool IsRTCheckAnalysisNeeded;
}; };
} // end anonymous namespace } // end anonymous namespace
@ -471,7 +482,7 @@ bool AccessAnalysis::canCheckPtrAtRT(
bool CanDoRT = true; bool CanDoRT = true;
NeedRTCheck = false; NeedRTCheck = false;
if (!IsRTCheckNeeded) return true; if (!IsRTCheckAnalysisNeeded) return true;
bool IsDepCheckNeeded = isDependencyCheckNeeded(); bool IsDepCheckNeeded = isDependencyCheckNeeded();
@ -653,7 +664,7 @@ void AccessAnalysis::processMemAccesses() {
// catch "a[i] = a[i] + " without having to do a dependence check). // catch "a[i] = a[i] + " without having to do a dependence check).
if ((IsWrite || IsReadOnlyPtr) && SetHasWrite) { if ((IsWrite || IsReadOnlyPtr) && SetHasWrite) {
CheckDeps.insert(Access); CheckDeps.insert(Access);
IsRTCheckNeeded = true; IsRTCheckAnalysisNeeded = true;
} }
if (IsWrite) if (IsWrite)