[llvm] e2858bf - [SCEV][NFC] Rename MaxAndComplete -> ConstantMaxAndComplete

Max Kazantsev via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 22 02:37:40 PDT 2020


Author: Max Kazantsev
Date: 2020-10-22T16:37:06+07:00
New Revision: e2858bf633b548cbf4e31b6b10852fccde940270

URL: https://github.com/llvm/llvm-project/commit/e2858bf633b548cbf4e31b6b10852fccde940270
DIFF: https://github.com/llvm/llvm-project/commit/e2858bf633b548cbf4e31b6b10852fccde940270.diff

LOG: [SCEV][NFC] Rename MaxAndComplete -> ConstantMaxAndComplete

This better reflects what this variable is about.

Added: 
    

Modified: 
    llvm/include/llvm/Analysis/ScalarEvolution.h
    llvm/lib/Analysis/ScalarEvolution.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Analysis/ScalarEvolution.h b/llvm/include/llvm/Analysis/ScalarEvolution.h
index adbb49f7d46b..a0047d38f26d 100644
--- a/llvm/include/llvm/Analysis/ScalarEvolution.h
+++ b/llvm/include/llvm/Analysis/ScalarEvolution.h
@@ -1317,26 +1317,28 @@ class ScalarEvolution {
     /// never have more than one computable exit.
     SmallVector<ExitNotTakenInfo, 1> ExitNotTaken;
 
-    /// The pointer part of \c MaxAndComplete is an expression indicating the
-    /// least maximum backedge-taken count of the loop that is known, or a
-    /// SCEVCouldNotCompute. This expression is only valid if the predicates
-    /// associated with all loop exits are true.
+    /// The pointer part of \c ConstantMaxAndComplete is an expression
+    /// indicating the least maximum backedge-taken count of the loop that is
+    /// known, or a SCEVCouldNotCompute. This expression is only valid if the
+    /// predicates associated with all loop exits are true.
     ///
-    /// The integer part of \c MaxAndComplete is a boolean indicating if \c
-    /// ExitNotTaken has an element for every exiting block in the loop.
-    PointerIntPair<const SCEV *, 1> MaxAndComplete;
+    /// The integer part of \c ConstantMaxAndComplete is a boolean indicating if
+    /// \c ExitNotTaken has an element for every exiting block in the loop.
+    PointerIntPair<const SCEV *, 1> ConstantMaxAndComplete;
 
     /// True iff the backedge is taken either exactly Max or zero times.
     bool MaxOrZero = false;
 
-    /// \name Helper projection functions on \c MaxAndComplete.
+    /// \name Helper projection functions on \c ConstantMaxAndComplete.
     /// @{
-    bool isComplete() const { return MaxAndComplete.getInt(); }
-    const SCEV *getMax() const { return MaxAndComplete.getPointer(); }
+    bool isComplete() const { return ConstantMaxAndComplete.getInt(); }
+    const SCEV *getConstantMax() const {
+      return ConstantMaxAndComplete.getPointer();
+    }
     /// @}
 
   public:
-    BackedgeTakenInfo() : MaxAndComplete(nullptr, 0) {}
+    BackedgeTakenInfo() : ConstantMaxAndComplete(nullptr, 0) {}
     BackedgeTakenInfo(BackedgeTakenInfo &&) = default;
     BackedgeTakenInfo &operator=(BackedgeTakenInfo &&) = default;
 
@@ -1349,7 +1351,8 @@ class ScalarEvolution {
     /// Test whether this BackedgeTakenInfo contains any computed information,
     /// or whether it's all SCEVCouldNotCompute values.
     bool hasAnyInfo() const {
-      return !ExitNotTaken.empty() || !isa<SCEVCouldNotCompute>(getMax());
+      return !ExitNotTaken.empty() ||
+             !isa<SCEVCouldNotCompute>(getConstantMax());
     }
 
     /// Test whether this BackedgeTakenInfo contains complete information.

diff  --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 638ae8489826..00d580b2f66c 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -6857,12 +6857,13 @@ ScalarEvolution::BackedgeTakenInfo::getConstantMax(ScalarEvolution *SE) const {
     return !ENT.hasAlwaysTruePredicate();
   };
 
-  if (any_of(ExitNotTaken, PredicateNotAlwaysTrue) || !getMax())
+  if (any_of(ExitNotTaken, PredicateNotAlwaysTrue) || !getConstantMax())
     return SE->getCouldNotCompute();
 
-  assert((isa<SCEVCouldNotCompute>(getMax()) || isa<SCEVConstant>(getMax())) &&
+  assert((isa<SCEVCouldNotCompute>(getConstantMax()) ||
+          isa<SCEVConstant>(getConstantMax())) &&
          "No point in having a non-constant max backedge taken count!");
-  return getMax();
+  return getConstantMax();
 }
 
 bool ScalarEvolution::BackedgeTakenInfo::isConstantMaxOrZero(
@@ -6875,8 +6876,8 @@ bool ScalarEvolution::BackedgeTakenInfo::isConstantMaxOrZero(
 
 bool ScalarEvolution::BackedgeTakenInfo::hasOperand(const SCEV *S,
                                                     ScalarEvolution *SE) const {
-  if (getMax() && getMax() != SE->getCouldNotCompute() &&
-      SE->hasOperand(getMax(), S))
+  if (getConstantMax() && getConstantMax() != SE->getCouldNotCompute() &&
+      SE->hasOperand(getConstantMax(), S))
     return true;
 
   for (auto &ENT : ExitNotTaken)
@@ -6932,7 +6933,7 @@ ScalarEvolution::BackedgeTakenInfo::BackedgeTakenInfo(
     ArrayRef<ScalarEvolution::BackedgeTakenInfo::EdgeExitInfo>
         ExitCounts,
     bool Complete, const SCEV *MaxCount, bool MaxOrZero)
-    : MaxAndComplete(MaxCount, Complete), MaxOrZero(MaxOrZero) {
+    : ConstantMaxAndComplete(MaxCount, Complete), MaxOrZero(MaxOrZero) {
   using EdgeExitInfo = ScalarEvolution::BackedgeTakenInfo::EdgeExitInfo;
 
   ExitNotTaken.reserve(ExitCounts.size());


        


More information about the llvm-commits mailing list