[polly] r267400 - Remove unnecessary argument of the SCEVValidator [NFC]

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 25 06:32:37 PDT 2016


Author: jdoerfert
Date: Mon Apr 25 08:32:36 2016
New Revision: 267400

URL: http://llvm.org/viewvc/llvm-project?rev=267400&view=rev
Log:
Remove unnecessary argument of the SCEVValidator [NFC]


Modified:
    polly/trunk/include/polly/ScopDetection.h
    polly/trunk/include/polly/Support/SCEVValidator.h
    polly/trunk/lib/Analysis/ScopDetection.cpp
    polly/trunk/lib/Analysis/ScopInfo.cpp
    polly/trunk/lib/Support/SCEVValidator.cpp

Modified: polly/trunk/include/polly/ScopDetection.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopDetection.h?rev=267400&r1=267399&r2=267400&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopDetection.h (original)
+++ polly/trunk/include/polly/ScopDetection.h Mon Apr 25 08:32:36 2016
@@ -440,9 +440,7 @@ private:
   /// @param S           The expression to be checked.
   /// @param Scope       The loop nest in which @p S is used.
   /// @param Context     The context of scop detection.
-  /// @param BaseAddress The base address of the expression @p S (if any).
-  bool isAffine(const SCEV *S, Loop *Scope, DetectionContext &Context,
-                Value *BaseAddress = nullptr) const;
+  bool isAffine(const SCEV *S, Loop *Scope, DetectionContext &Context) const;
 
   /// @brief Check if the control flow in a basic block is valid.
   ///

Modified: polly/trunk/include/polly/Support/SCEVValidator.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/Support/SCEVValidator.h?rev=267400&r1=267399&r2=267400&view=diff
==============================================================================
--- polly/trunk/include/polly/Support/SCEVValidator.h (original)
+++ polly/trunk/include/polly/Support/SCEVValidator.h Mon Apr 25 08:32:36 2016
@@ -55,7 +55,6 @@ bool hasScalarDepsInsideRegion(const llv
                                llvm::Loop *Scope, bool AllowLoops);
 bool isAffineExpr(const llvm::Region *R, llvm::Loop *Scope,
                   const llvm::SCEV *Expression, llvm::ScalarEvolution &SE,
-                  const llvm::Value *BaseAddress = 0,
                   InvariantLoadsSetTy *ILS = nullptr);
 
 /// @brief Check if @p V describes an affine parameter constraint in @p R.
@@ -66,8 +65,7 @@ bool isAffineParamConstraint(llvm::Value
 
 std::vector<const llvm::SCEV *>
 getParamsInAffineExpr(const llvm::Region *R, llvm::Loop *Scope,
-                      const llvm::SCEV *Expression, llvm::ScalarEvolution &SE,
-                      const llvm::Value *BaseAddress = 0);
+                      const llvm::SCEV *Expression, llvm::ScalarEvolution &SE);
 
 /// @brief Extract the constant factors from the multiplication @p M.
 ///

Modified: polly/trunk/lib/Analysis/ScopDetection.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetection.cpp?rev=267400&r1=267399&r2=267400&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetection.cpp Mon Apr 25 08:32:36 2016
@@ -330,11 +330,10 @@ bool ScopDetection::onlyValidRequiredInv
 }
 
 bool ScopDetection::isAffine(const SCEV *S, Loop *Scope,
-                             DetectionContext &Context,
-                             Value *BaseAddress) const {
+                             DetectionContext &Context) const {
 
   InvariantLoadsSetTy AccessILS;
-  if (!isAffineExpr(&Context.CurRegion, Scope, S, *SE, BaseAddress, &AccessILS))
+  if (!isAffineExpr(&Context.CurRegion, Scope, S, *SE, &AccessILS))
     return false;
 
   if (!onlyValidRequiredInvariantLoads(AccessILS, Context))
@@ -731,7 +730,7 @@ bool ScopDetection::hasValidArraySizes(D
   Value *BaseValue = BasePointer->getValue();
   Region &CurRegion = Context.CurRegion;
   for (const SCEV *DelinearizedSize : Sizes) {
-    if (!isAffine(DelinearizedSize, Scope, Context, nullptr)) {
+    if (!isAffine(DelinearizedSize, Scope, Context)) {
       Sizes.clear();
       break;
     }
@@ -759,7 +758,7 @@ bool ScopDetection::hasValidArraySizes(D
       const Instruction *Insn = Pair.first;
       const SCEV *AF = Pair.second;
 
-      if (!isAffine(AF, Scope, Context, BaseValue)) {
+      if (!isAffine(AF, Scope, Context)) {
         invalid<ReportNonAffineAccess>(Context, /*Assert=*/true, AF, Insn,
                                        BaseValue);
         if (!KeepGoing)
@@ -793,7 +792,7 @@ bool ScopDetection::computeAccessFunctio
     auto *Scope = LI->getLoopFor(Insn->getParent());
 
     if (!AF) {
-      if (isAffine(Pair.second, Scope, Context, BaseValue))
+      if (isAffine(Pair.second, Scope, Context))
         Acc->DelinearizedSubscripts.push_back(Pair.second);
       else
         IsNonAffine = true;
@@ -803,7 +802,7 @@ bool ScopDetection::computeAccessFunctio
       if (Acc->DelinearizedSubscripts.size() == 0)
         IsNonAffine = true;
       for (const SCEV *S : Acc->DelinearizedSubscripts)
-        if (!isAffine(S, Scope, Context, BaseValue))
+        if (!isAffine(S, Scope, Context))
           IsNonAffine = true;
     }
 
@@ -910,7 +909,7 @@ bool ScopDetection::isValidAccess(Instru
       IsVariantInNonAffineLoop = true;
 
   auto *Scope = LI->getLoopFor(Inst->getParent());
-  bool IsAffine = !IsVariantInNonAffineLoop && isAffine(AF, Scope, Context, BV);
+  bool IsAffine = !IsVariantInNonAffineLoop && isAffine(AF, Scope, Context);
   // Do not try to delinearize memory intrinsics and force them to be affine.
   if (isa<MemIntrinsic>(Inst) && !IsAffine) {
     return invalid<ReportNonAffineAccess>(Context, /*Assert=*/true, AF, Inst,

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=267400&r1=267399&r2=267400&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Mon Apr 25 08:32:36 2016
@@ -1405,8 +1405,7 @@ void ScopStmt::deriveAssumptionsFromGEP(
 
     auto *Scope = SD.getLI()->getLoopFor(getEntryBlock());
     InvariantLoadsSetTy AccessILS;
-    if (!isAffineExpr(&Parent.getRegion(), Scope, Expr, SE, nullptr,
-                      &AccessILS))
+    if (!isAffineExpr(&Parent.getRegion(), Scope, Expr, SE, &AccessILS))
       continue;
 
     bool NonAffine = false;
@@ -4234,7 +4233,7 @@ bool ScopInfo::buildAccessMultiDimFixed(
 
   for (auto *Subscript : Subscripts) {
     InvariantLoadsSetTy AccessILS;
-    if (!isAffineExpr(R, L, Subscript, *SE, nullptr, &AccessILS))
+    if (!isAffineExpr(R, L, Subscript, *SE, &AccessILS))
       return false;
 
     for (LoadInst *LInst : AccessILS)
@@ -4313,7 +4312,7 @@ bool ScopInfo::buildAccessMemIntrinsic(
 
   // Check if the length val is actually affine or if we overapproximate it
   InvariantLoadsSetTy AccessILS;
-  bool LengthIsAffine = isAffineExpr(R, L, LengthVal, *SE, nullptr, &AccessILS);
+  bool LengthIsAffine = isAffineExpr(R, L, LengthVal, *SE, &AccessILS);
   for (LoadInst *LInst : AccessILS)
     if (!ScopRIL.count(LInst))
       LengthIsAffine = false;
@@ -4439,8 +4438,7 @@ void ScopInfo::buildAccessSingleDim(
 
   InvariantLoadsSetTy AccessILS;
   bool IsAffine = !isVariantInNonAffineLoop &&
-                  isAffineExpr(R, L, AccessFunction, *SE,
-                               BasePointer->getValue(), &AccessILS);
+                  isAffineExpr(R, L, AccessFunction, *SE, &AccessILS);
 
   for (LoadInst *LInst : AccessILS)
     if (!ScopRIL.count(LInst))

Modified: polly/trunk/lib/Support/SCEVValidator.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/SCEVValidator.cpp?rev=267400&r1=267399&r2=267400&view=diff
==============================================================================
--- polly/trunk/lib/Support/SCEVValidator.cpp (original)
+++ polly/trunk/lib/Support/SCEVValidator.cpp Mon Apr 25 08:32:36 2016
@@ -126,13 +126,12 @@ private:
   const Region *R;
   Loop *Scope;
   ScalarEvolution &SE;
-  const Value *BaseAddress;
   InvariantLoadsSetTy *ILS;
 
 public:
   SCEVValidator(const Region *R, Loop *Scope, ScalarEvolution &SE,
-                const Value *BaseAddress, InvariantLoadsSetTy *ILS)
-      : R(R), Scope(Scope), SE(SE), BaseAddress(BaseAddress), ILS(ILS) {}
+                InvariantLoadsSetTy *ILS)
+      : R(R), Scope(Scope), SE(SE), ILS(ILS) {}
 
   class ValidatorResult visitConstant(const SCEVConstant *Constant) {
     return ValidatorResult(SCEVType::INT);
@@ -396,11 +395,6 @@ public:
       return ValidatorResult(SCEVType::INVALID);
     }
 
-    if (BaseAddress == V) {
-      DEBUG(dbgs() << "INVALID: UnknownExpr references BaseAddress\n");
-      return ValidatorResult(SCEVType::INVALID);
-    }
-
     if (Instruction *I = dyn_cast<Instruction>(Expr->getValue())) {
       switch (I->getOpcode()) {
       case Instruction::Load:
@@ -530,12 +524,11 @@ bool hasScalarDepsInsideRegion(const SCE
 }
 
 bool isAffineExpr(const Region *R, llvm::Loop *Scope, const SCEV *Expr,
-                  ScalarEvolution &SE, const Value *BaseAddress,
-                  InvariantLoadsSetTy *ILS) {
+                  ScalarEvolution &SE, InvariantLoadsSetTy *ILS) {
   if (isa<SCEVCouldNotCompute>(Expr))
     return false;
 
-  SCEVValidator Validator(R, Scope, SE, BaseAddress, ILS);
+  SCEVValidator Validator(R, Scope, SE, ILS);
   DEBUG({
     dbgs() << "\n";
     dbgs() << "Expr: " << *Expr << "\n";
@@ -561,7 +554,7 @@ static bool isAffineParamExpr(Value *V,
   if (isa<SCEVCouldNotCompute>(E))
     return false;
 
-  SCEVValidator Validator(R, Scope, SE, nullptr, nullptr);
+  SCEVValidator Validator(R, Scope, SE, nullptr);
   ValidatorResult Result = Validator.visit(E);
   if (!Result.isConstant())
     return false;
@@ -598,13 +591,12 @@ bool isAffineParamConstraint(Value *V, c
 
 std::vector<const SCEV *> getParamsInAffineExpr(const Region *R, Loop *Scope,
                                                 const SCEV *Expr,
-                                                ScalarEvolution &SE,
-                                                const Value *BaseAddress) {
+                                                ScalarEvolution &SE) {
   if (isa<SCEVCouldNotCompute>(Expr))
     return std::vector<const SCEV *>();
 
   InvariantLoadsSetTy ILS;
-  SCEVValidator Validator(R, Scope, SE, BaseAddress, &ILS);
+  SCEVValidator Validator(R, Scope, SE, &ILS);
   ValidatorResult Result = Validator.visit(Expr);
   assert(Result.isValid() && "Requested parameters for an invalid SCEV!");
 




More information about the llvm-commits mailing list