[llvm-commits] [llvm] r73907 - in /llvm/trunk: include/llvm/Analysis/ScalarEvolution.h include/llvm/Analysis/ScalarEvolutionExpressions.h lib/Analysis/ScalarEvolution.cpp

Owen Anderson resistor at mac.com
Mon Jun 22 14:57:23 PDT 2009


Author: resistor
Date: Mon Jun 22 16:57:23 2009
New Revision: 73907

URL: http://llvm.org/viewvc/llvm-project?rev=73907&view=rev
Log:
Remove the parent pointer from SCEV, since it did not end up being needed.

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

Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolution.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolution.h?rev=73907&r1=73906&r2=73907&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Analysis/ScalarEvolution.h (original)
+++ llvm/trunk/include/llvm/Analysis/ScalarEvolution.h Mon Jun 22 16:57:23 2009
@@ -50,15 +50,13 @@
   class SCEV {
     const unsigned SCEVType;      // The SCEV baseclass this node corresponds to
 
-    const ScalarEvolution* parent;
-
     SCEV(const SCEV &);            // DO NOT IMPLEMENT
     void operator=(const SCEV &);  // DO NOT IMPLEMENT
   protected:
     virtual ~SCEV();
   public:
-    explicit SCEV(unsigned SCEVTy, const ScalarEvolution* p) : 
-      SCEVType(SCEVTy), parent(p) {}
+    explicit SCEV(unsigned SCEVTy) : 
+      SCEVType(SCEVTy) {}
 
     unsigned getSCEVType() const { return SCEVType; }
 
@@ -126,8 +124,7 @@
   /// None of the standard SCEV operations are valid on this class, it is just a
   /// marker.
   struct SCEVCouldNotCompute : public SCEV {
-    SCEVCouldNotCompute(const ScalarEvolution* p);
-    ~SCEVCouldNotCompute();
+    SCEVCouldNotCompute();
 
     // None of these methods are valid for this object.
     virtual bool isLoopInvariant(const Loop *L) const;

Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h?rev=73907&r1=73906&r2=73907&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h (original)
+++ llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h Mon Jun 22 16:57:23 2009
@@ -36,8 +36,8 @@
     friend class ScalarEvolution;
 
     ConstantInt *V;
-    explicit SCEVConstant(ConstantInt *v, const ScalarEvolution* p) :
-      SCEV(scConstant, p), V(v) {}
+    explicit SCEVConstant(ConstantInt *v) :
+      SCEV(scConstant), V(v) {}
   public:
     ConstantInt *getValue() const { return V; }
 
@@ -78,9 +78,7 @@
     const SCEV* Op;
     const Type *Ty;
 
-    SCEVCastExpr(unsigned SCEVTy, const SCEV* op, const Type *ty,
-                 const ScalarEvolution* p);
-    virtual ~SCEVCastExpr();
+    SCEVCastExpr(unsigned SCEVTy, const SCEV* op, const Type *ty);
 
   public:
     const SCEV* getOperand() const { return Op; }
@@ -112,8 +110,7 @@
   class SCEVTruncateExpr : public SCEVCastExpr {
     friend class ScalarEvolution;
 
-    SCEVTruncateExpr(const SCEV* op, const Type *ty,
-                     const ScalarEvolution* p);
+    SCEVTruncateExpr(const SCEV* op, const Type *ty);
 
   public:
     const SCEV* replaceSymbolicValuesWithConcrete(const SCEV* Sym,
@@ -141,8 +138,7 @@
   class SCEVZeroExtendExpr : public SCEVCastExpr {
     friend class ScalarEvolution;
 
-    SCEVZeroExtendExpr(const SCEV* op, const Type *ty,
-                       const ScalarEvolution* p);
+    SCEVZeroExtendExpr(const SCEV* op, const Type *ty);
 
   public:
     const SCEV* replaceSymbolicValuesWithConcrete(const SCEV* Sym,
@@ -170,8 +166,7 @@
   class SCEVSignExtendExpr : public SCEVCastExpr {
     friend class ScalarEvolution;
 
-    SCEVSignExtendExpr(const SCEV* op, const Type *ty,
-                       const ScalarEvolution* p);
+    SCEVSignExtendExpr(const SCEV* op, const Type *ty);
 
   public:
     const SCEV* replaceSymbolicValuesWithConcrete(const SCEV* Sym,
@@ -201,10 +196,8 @@
   protected:
     SmallVector<const SCEV*, 8> Operands;
 
-    SCEVNAryExpr(enum SCEVTypes T, const SmallVectorImpl<const SCEV*> &ops,
-                 const ScalarEvolution* p)
-      : SCEV(T, p), Operands(ops.begin(), ops.end()) {}
-    virtual ~SCEVNAryExpr() {}
+    SCEVNAryExpr(enum SCEVTypes T, const SmallVectorImpl<const SCEV*> &ops)
+      : SCEV(T), Operands(ops.begin(), ops.end()) {}
 
   public:
     unsigned getNumOperands() const { return (unsigned)Operands.size(); }
@@ -261,9 +254,8 @@
   class SCEVCommutativeExpr : public SCEVNAryExpr {
   protected:
     SCEVCommutativeExpr(enum SCEVTypes T,
-                        const SmallVectorImpl<const SCEV*> &ops,
-                        const ScalarEvolution* p)
-      : SCEVNAryExpr(T, ops, p) {}
+                        const SmallVectorImpl<const SCEV*> &ops)
+      : SCEVNAryExpr(T, ops) {}
 
   public:
     const SCEV* replaceSymbolicValuesWithConcrete(const SCEV* Sym,
@@ -291,9 +283,8 @@
   class SCEVAddExpr : public SCEVCommutativeExpr {
     friend class ScalarEvolution;
 
-    explicit SCEVAddExpr(const SmallVectorImpl<const SCEV*> &ops,
-                         const ScalarEvolution* p)
-      : SCEVCommutativeExpr(scAddExpr, ops, p) {
+    explicit SCEVAddExpr(const SmallVectorImpl<const SCEV*> &ops)
+      : SCEVCommutativeExpr(scAddExpr, ops) {
     }
 
   public:
@@ -312,9 +303,8 @@
   class SCEVMulExpr : public SCEVCommutativeExpr {
     friend class ScalarEvolution;
 
-    explicit SCEVMulExpr(const SmallVectorImpl<const SCEV*> &ops,
-                         const ScalarEvolution* p)
-      : SCEVCommutativeExpr(scMulExpr, ops, p) {
+    explicit SCEVMulExpr(const SmallVectorImpl<const SCEV*> &ops)
+      : SCEVCommutativeExpr(scMulExpr, ops) {
     }
 
   public:
@@ -336,9 +326,8 @@
 
     const SCEV* LHS;
     const SCEV* RHS;
-    SCEVUDivExpr(const SCEV* lhs, const SCEV* rhs,
-                 const ScalarEvolution* p)
-      : SCEV(scUDivExpr, p), LHS(lhs), RHS(rhs) {}
+    SCEVUDivExpr(const SCEV* lhs, const SCEV* rhs)
+      : SCEV(scUDivExpr), LHS(lhs), RHS(rhs) {}
 
   public:
     const SCEV* getLHS() const { return LHS; }
@@ -392,9 +381,8 @@
 
     const Loop *L;
 
-    SCEVAddRecExpr(const SmallVectorImpl<const SCEV*> &ops, const Loop *l,
-                   const ScalarEvolution* p)
-      : SCEVNAryExpr(scAddRecExpr, ops, p), L(l) {
+    SCEVAddRecExpr(const SmallVectorImpl<const SCEV*> &ops, const Loop *l)
+      : SCEVNAryExpr(scAddRecExpr, ops), L(l) {
       for (size_t i = 0, e = Operands.size(); i != e; ++i)
         assert(Operands[i]->isLoopInvariant(l) &&
                "Operands of AddRec must be loop-invariant!");
@@ -468,9 +456,8 @@
   class SCEVSMaxExpr : public SCEVCommutativeExpr {
     friend class ScalarEvolution;
 
-    explicit SCEVSMaxExpr(const SmallVectorImpl<const SCEV*> &ops,
-                          const ScalarEvolution* p)
-      : SCEVCommutativeExpr(scSMaxExpr, ops, p) {
+    explicit SCEVSMaxExpr(const SmallVectorImpl<const SCEV*> &ops)
+      : SCEVCommutativeExpr(scSMaxExpr, ops) {
     }
 
   public:
@@ -490,9 +477,8 @@
   class SCEVUMaxExpr : public SCEVCommutativeExpr {
     friend class ScalarEvolution;
 
-    explicit SCEVUMaxExpr(const SmallVectorImpl<const SCEV*> &ops,
-                          const ScalarEvolution* p)
-      : SCEVCommutativeExpr(scUMaxExpr, ops, p) {
+    explicit SCEVUMaxExpr(const SmallVectorImpl<const SCEV*> &ops)
+      : SCEVCommutativeExpr(scUMaxExpr, ops) {
     }
 
   public:
@@ -515,8 +501,8 @@
     friend class ScalarEvolution;
 
     Value *V;
-    explicit SCEVUnknown(Value *v, const ScalarEvolution* p) :
-      SCEV(scUnknown, p), V(v) {}
+    explicit SCEVUnknown(Value *v) :
+      SCEV(scUnknown), V(v) {}
       
   public:
     Value *getValue() const { return V; }

Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=73907&r1=73906&r2=73907&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Mon Jun 22 16:57:23 2009
@@ -76,7 +76,6 @@
 #include "llvm/Support/ConstantRange.h"
 #include "llvm/Support/GetElementPtrTypeIterator.h"
 #include "llvm/Support/InstIterator.h"
-#include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/ADT/Statistic.h"
@@ -133,9 +132,8 @@
   return false;
 }
 
-SCEVCouldNotCompute::SCEVCouldNotCompute(const ScalarEvolution* p) :
-  SCEV(scCouldNotCompute, p) {}
-SCEVCouldNotCompute::~SCEVCouldNotCompute() {}
+SCEVCouldNotCompute::SCEVCouldNotCompute() :
+  SCEV(scCouldNotCompute) {}
 
 bool SCEVCouldNotCompute::isLoopInvariant(const Loop *L) const {
   assert(0 && "Attempt to use a SCEVCouldNotCompute object!");
@@ -174,7 +172,7 @@
 
 const SCEV* ScalarEvolution::getConstant(ConstantInt *V) {
   SCEVConstant *&R = SCEVConstants[V];
-  if (R == 0) R = new SCEVConstant(V, this);
+  if (R == 0) R = new SCEVConstant(V);
   return R;
 }
 
@@ -194,11 +192,8 @@
 }
 
 SCEVCastExpr::SCEVCastExpr(unsigned SCEVTy,
-                           const SCEV* op, const Type *ty,
-                           const ScalarEvolution* p)
-  : SCEV(SCEVTy, p), Op(op), Ty(ty) {}
-
-SCEVCastExpr::~SCEVCastExpr() {}
+                           const SCEV* op, const Type *ty)
+  : SCEV(SCEVTy), Op(op), Ty(ty) {}
 
 bool SCEVCastExpr::dominates(BasicBlock *BB, DominatorTree *DT) const {
   return Op->dominates(BB, DT);
@@ -208,9 +203,8 @@
 // particular input.  Don't use a const SCEV* here, or else the object will
 // never be deleted!
 
-SCEVTruncateExpr::SCEVTruncateExpr(const SCEV* op, const Type *ty,
-                                   const ScalarEvolution* p)
-  : SCEVCastExpr(scTruncate, op, ty, p) {
+SCEVTruncateExpr::SCEVTruncateExpr(const SCEV* op, const Type *ty)
+  : SCEVCastExpr(scTruncate, op, ty) {
   assert((Op->getType()->isInteger() || isa<PointerType>(Op->getType())) &&
          (Ty->isInteger() || isa<PointerType>(Ty)) &&
          "Cannot truncate non-integer value!");
@@ -225,9 +219,8 @@
 // particular input.  Don't use a const SCEV* here, or else the object will never
 // be deleted!
 
-SCEVZeroExtendExpr::SCEVZeroExtendExpr(const SCEV* op, const Type *ty,
-                                       const ScalarEvolution* p)
-  : SCEVCastExpr(scZeroExtend, op, ty, p) {
+SCEVZeroExtendExpr::SCEVZeroExtendExpr(const SCEV* op, const Type *ty)
+  : SCEVCastExpr(scZeroExtend, op, ty) {
   assert((Op->getType()->isInteger() || isa<PointerType>(Op->getType())) &&
          (Ty->isInteger() || isa<PointerType>(Ty)) &&
          "Cannot zero extend non-integer value!");
@@ -241,9 +234,8 @@
 // particular input.  Don't use a const SCEV* here, or else the object will never
 // be deleted!
 
-SCEVSignExtendExpr::SCEVSignExtendExpr(const SCEV* op, const Type *ty,
-                                       const ScalarEvolution* p)
-  : SCEVCastExpr(scSignExtend, op, ty, p) {
+SCEVSignExtendExpr::SCEVSignExtendExpr(const SCEV* op, const Type *ty)
+  : SCEVCastExpr(scSignExtend, op, ty) {
   assert((Op->getType()->isInteger() || isa<PointerType>(Op->getType())) &&
          (Ty->isInteger() || isa<PointerType>(Ty)) &&
          "Cannot sign extend non-integer value!");
@@ -745,7 +737,7 @@
   }
 
   SCEVTruncateExpr *&Result = SCEVTruncates[std::make_pair(Op, Ty)];
-  if (Result == 0) Result = new SCEVTruncateExpr(Op, Ty, this);
+  if (Result == 0) Result = new SCEVTruncateExpr(Op, Ty);
   return Result;
 }
 
@@ -833,7 +825,7 @@
     }
 
   SCEVZeroExtendExpr *&Result = SCEVZeroExtends[std::make_pair(Op, Ty)];
-  if (Result == 0) Result = new SCEVZeroExtendExpr(Op, Ty, this);
+  if (Result == 0) Result = new SCEVZeroExtendExpr(Op, Ty);
   return Result;
 }
 
@@ -905,7 +897,7 @@
     }
 
   SCEVSignExtendExpr *&Result = SCEVSignExtends[std::make_pair(Op, Ty)];
-  if (Result == 0) Result = new SCEVSignExtendExpr(Op, Ty, this);
+  if (Result == 0) Result = new SCEVSignExtendExpr(Op, Ty);
   return Result;
 }
 
@@ -1367,7 +1359,7 @@
   std::vector<const SCEV*> SCEVOps(Ops.begin(), Ops.end());
   SCEVCommutativeExpr *&Result = SCEVCommExprs[std::make_pair(scAddExpr,
                                                                  SCEVOps)];
-  if (Result == 0) Result = new SCEVAddExpr(Ops, this);
+  if (Result == 0) Result = new SCEVAddExpr(Ops);
   return Result;
 }
 
@@ -1533,7 +1525,7 @@
   SCEVCommutativeExpr *&Result = SCEVCommExprs[std::make_pair(scMulExpr,
                                                                  SCEVOps)];
   if (Result == 0)
-    Result = new SCEVMulExpr(Ops, this);
+    Result = new SCEVMulExpr(Ops);
   return Result;
 }
 
@@ -1624,7 +1616,7 @@
   }
 
   SCEVUDivExpr *&Result = SCEVUDivs[std::make_pair(LHS, RHS)];
-  if (Result == 0) Result = new SCEVUDivExpr(LHS, RHS, this);
+  if (Result == 0) Result = new SCEVUDivExpr(LHS, RHS);
   return Result;
 }
 
@@ -1677,7 +1669,7 @@
 
   std::vector<const SCEV*> SCEVOps(Operands.begin(), Operands.end());
   SCEVAddRecExpr *&Result = SCEVAddRecExprs[std::make_pair(L, SCEVOps)];
-  if (Result == 0) Result = new SCEVAddRecExpr(Operands, L, this);
+  if (Result == 0) Result = new SCEVAddRecExpr(Operands, L);
   return Result;
 }
 
@@ -1764,7 +1756,7 @@
   std::vector<const SCEV*> SCEVOps(Ops.begin(), Ops.end());
   SCEVCommutativeExpr *&Result = SCEVCommExprs[std::make_pair(scSMaxExpr,
                                                                  SCEVOps)];
-  if (Result == 0) Result = new SCEVSMaxExpr(Ops, this);
+  if (Result == 0) Result = new SCEVSMaxExpr(Ops);
   return Result;
 }
 
@@ -1851,7 +1843,7 @@
   std::vector<const SCEV*> SCEVOps(Ops.begin(), Ops.end());
   SCEVCommutativeExpr *&Result = SCEVCommExprs[std::make_pair(scUMaxExpr,
                                                                  SCEVOps)];
-  if (Result == 0) Result = new SCEVUMaxExpr(Ops, this);
+  if (Result == 0) Result = new SCEVUMaxExpr(Ops);
   return Result;
 }
 
@@ -1873,7 +1865,7 @@
   if (isa<ConstantPointerNull>(V))
     return getIntegerSCEV(0, V->getType());
   SCEVUnknown *&Result = SCEVUnknowns[V];
-  if (Result == 0) Result = new SCEVUnknown(V, this);
+  if (Result == 0) Result = new SCEVUnknown(V);
   return Result;
 }
 
@@ -4261,7 +4253,7 @@
 //===----------------------------------------------------------------------===//
 
 ScalarEvolution::ScalarEvolution()
-  : FunctionPass(&ID), CouldNotCompute(new SCEVCouldNotCompute(0)) {
+  : FunctionPass(&ID), CouldNotCompute(new SCEVCouldNotCompute()) {
 }
 
 bool ScalarEvolution::runOnFunction(Function &F) {





More information about the llvm-commits mailing list