[llvm-commits] [polly] r144223 - in /polly/trunk: include/polly/TempScopInfo.h lib/Analysis/ScopInfo.cpp lib/Analysis/TempScopInfo.cpp test/ScopInfo/sum.ll

Tobias Grosser grosser at fim.uni-passau.de
Wed Nov 9 14:34:34 PST 2011


Author: grosser
Date: Wed Nov  9 16:34:34 2011
New Revision: 144223

URL: http://llvm.org/viewvc/llvm-project?rev=144223&view=rev
Log:
Remove more of SCEVAffineFunc

Removed:
    polly/trunk/test/ScopInfo/sum.ll
Modified:
    polly/trunk/include/polly/TempScopInfo.h
    polly/trunk/lib/Analysis/ScopInfo.cpp
    polly/trunk/lib/Analysis/TempScopInfo.cpp

Modified: polly/trunk/include/polly/TempScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/TempScopInfo.h?rev=144223&r1=144222&r2=144223&view=diff
==============================================================================
--- polly/trunk/include/polly/TempScopInfo.h (original)
+++ polly/trunk/include/polly/TempScopInfo.h Wed Nov  9 16:34:34 2011
@@ -317,17 +317,6 @@
   // Clear the context.
   void clear();
 
-  /// @brief Build an affine function from a SCEV expression.
-  ///
-  /// @param S            The SCEV expression to be converted to affine
-  ///                     function.
-  /// @param Scop         The Scope of this expression.
-  /// @param FuncToBuild  The SCEVAffFunc to hold the result.
-  ///
-  void buildAffineFunction(const SCEV *S, SCEVAffFunc &FuncToBuild,
-                           Region &R, ParamSetType &Params) const;
-
-
   /// @brief Build condition constrains to BBs in a valid Scop.
   ///
   /// @param BB           The BasicBlock to build condition constrains

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=144223&r1=144222&r2=144223&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Wed Nov  9 16:34:34 2011
@@ -82,19 +82,18 @@
 
 public:
   static isl_pw_aff *getPwAff(ScopStmt *stmt, const SCEV *scev,
-                              bool isMemoryAccess = false) {
+                              Value **BaseAddress = NULL) {
     Scop *S = stmt->getParent();
     const Region *Reg = &S->getRegion();
 
-    Value *BaseAddress = NULL;
-
-    if (isMemoryAccess) {
-      S->addParams(getParamsInAffineExpr(Reg, scev, *S->getSE(), &BaseAddress));
+    if (BaseAddress) {
+      S->addParams(getParamsInAffineExpr(Reg, scev, *S->getSE(), BaseAddress));
     } else {
       S->addParams(getParamsInAffineExpr(Reg, scev, *S->getSE()));
     }
 
-    SCEVAffinator Affinator(stmt,  BaseAddress);
+    Value *Base = BaseAddress ? *BaseAddress : NULL;
+    SCEVAffinator Affinator(stmt, Base);
     return Affinator.visit(scev);
   }
 
@@ -327,14 +326,15 @@
 
 MemoryAccess::MemoryAccess(const SCEVAffFunc &AffFunc, ScopStmt *Statement) {
   newAccessRelation = NULL;
-  BaseAddr = AffFunc.getBaseAddr();
   Type = AffFunc.isRead() ? Read : Write;
   statement = Statement;
 
-  setBaseName();
-
+  Value *TmpBaseAddress = NULL;
   isl_pw_aff *Affine = SCEVAffinator::getPwAff(Statement, AffFunc.OriginalSCEV,
-                                               true);
+                                               &TmpBaseAddress);
+  BaseAddr = TmpBaseAddress;
+
+  setBaseName();
 
   // Devide the access function by the size of the elements in the array.
   //

Modified: polly/trunk/lib/Analysis/TempScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/TempScopInfo.cpp?rev=144223&r1=144222&r2=144223&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/TempScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/TempScopInfo.cpp Wed Nov  9 16:34:34 2011
@@ -75,32 +75,6 @@
 }
 
 void SCEVAffFunc::print(raw_ostream &OS, bool PrintInequality) const {
-  // Print BaseAddr.
-  if (isDataRef()) {
-    OS << (isRead() ? "Reads" : "Writes") << " ";
-    WriteAsOperand(OS, getBaseAddr(), false);
-    OS << "[";
-  }
-
-  for (LnrTransSet::const_iterator I = LnrTrans.begin(), E = LnrTrans.end();
-    I != E; ++I)
-    OS << *I->second << " * " << *I->first << " + ";
-
-  if (TransComp)
-    OS << *TransComp;
-
-  if (isDataRef())
-    OS << "]";
-
-  if (!PrintInequality)
-    return;
-
-  if (getType() == GE)
-    OS << " >= 0";
-  else if (getType() == Eq)
-    OS << " == 0";
-  else if (getType() == Ne)
-    OS << " != 0";
 }
 
 void SCEVAffFunc::dump() const {
@@ -152,74 +126,6 @@
 void TempScop::printDetail(llvm::raw_ostream &OS, ScalarEvolution *SE,
                            LoopInfo *LI, const Region *CurR,
                            unsigned ind) const {
-  // Print the loop bounds,  if the current region is a loop.
-  LoopBoundMapType::const_iterator at = LoopBounds.find(castToLoop(*CurR, *LI));
-  if (at != LoopBounds.end()) {
-    OS.indent(ind) << "Bounds of Loop: " << at->first->getHeader()->getName()
-      << ":\t{ ";
-    OS << *(at->second);
-    OS << " }\n";
-    ind += 2;
-  }
-
-  // Iterate over the region nodes of this Scop to print the access functions
-  // and loop bounds.
-  for (Region::const_element_iterator I = CurR->element_begin(),
-       E = CurR->element_end(); I != E; ++I) {
-    if (I->isSubRegion()) {
-      Region *subR = I->getNodeAs<Region>();
-      printDetail(OS, SE, LI, subR, ind + 2);
-    } else {
-      BasicBlock *BB = I->getNodeAs<BasicBlock>();
-
-      if (const AccFuncSetType *AccFunc = getAccessFunctions(BB)) {
-        OS.indent(ind) << "BB: " << BB->getName() << "{\n";
-
-        for (AccFuncSetType::const_iterator FI = AccFunc->begin(),
-             FE = AccFunc->end(); FI != FE; ++FI) {
-          const SCEVAffFunc &AF = FI->first;
-          const Value *Ptr = AF.getBaseAddr();
-
-          OS.indent(ind + 2) << AF << "  Refs: ";
-          for (MayAliasSetInfo::const_alias_iterator
-               MI = MayASInfo->alias_begin(Ptr), ME = MayASInfo->alias_end(Ptr);
-               MI != ME; ++MI) {
-            MI->second->print(OS);
-            OS << ", ";
-          }
-
-          OS << '\n';
-        }
-
-        OS.indent(ind) << "}\n";
-      }
-    }
-  }
-}
-
-void TempScopInfo::buildAffineFunction(const SCEV *S, SCEVAffFunc &FuncToBuild,
-                                       Region &R, ParamSetType &Params) const {
-  assert(S && "S can not be null!");
-
-  assert(!isa<SCEVCouldNotCompute>(S)
-    && "Un Expect broken affine function in Scop!");
-
-  for (AffineSCEVIterator I = affine_begin(S, SE), E = affine_end();
-      I != E; ++I) {
-    // The constant part must be a SCEVConstant.
-    // TODO: support sizeof in coefficient.
-    assert(isa<SCEVConstant>(I->second) && "Expect SCEVConst in coefficient!");
-
-    const SCEV *Var = I->first;
-    // Extract the constant part
-    if (isa<SCEVConstant>(Var))
-      ;
-    else if (Var->getType()->isPointerTy()) { // Extract the base address
-      const SCEVUnknown *BaseAddr = dyn_cast<SCEVUnknown>(Var);
-      assert(BaseAddr && "Why we got a broken scev?");
-      FuncToBuild.BaseAddr = BaseAddr->getValue();
-    }
-  }
 }
 
 void TempScopInfo::buildAccessFunctions(Region &R, ParamSetType &Parameter,
@@ -244,8 +150,6 @@
       const SCEV *AccessFunction = SE->getSCEV(getPointerOperand(Inst));
       Functions.push_back(
         std::make_pair(SCEVAffFunc(Type, AccessFunction, Size), &Inst));
-
-      buildAffineFunction(AccessFunction, Functions.back().first, R, Parameter);
     }
   }
 

Removed: polly/trunk/test/ScopInfo/sum.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/sum.ll?rev=144222&view=auto
==============================================================================
--- polly/trunk/test/ScopInfo/sum.ll (original)
+++ polly/trunk/test/ScopInfo/sum.ll (removed)
@@ -1,38 +0,0 @@
-; RUN: opt %loadPolly %defaultOpts -polly-prepare -polly-analyze-ir -analyze %s | FileCheck %s
-
-target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
-target triple = "x86_64-linux-gnu"
-
-;long f(long a[], long n) {
-;  long i, k;
-;  k = 0;
-;  for (i = 1; i < n; ++i) {
-;   k += a[i];
-;  }
-;  return k;
-;}
-define i64 @f(i64* nocapture %a, i64 %n) nounwind readonly {
-entry:
-  %0 = icmp sgt i64 %n, 1                         ; <i1> [#uses=1]
-  br i1 %0, label %bb.nph, label %bb2
-
-bb.nph:                                           ; preds = %entry
-  %tmp = add i64 %n, -1                           ; <i64> [#uses=1]
-  br label %bb
-
-bb:                                               ; preds = %bb, %bb.nph
-  %indvar = phi i64 [ 0, %bb.nph ], [ %tmp6, %bb ] ; <i64> [#uses=1]
-  %k.05 = phi i64 [ 0, %bb.nph ], [ %2, %bb ]     ; <i64> [#uses=1]
-  %tmp6 = add i64 %indvar, 1                      ; <i64> [#uses=3]
-  %scevgep = getelementptr i64* %a, i64 %tmp6     ; <i64*> [#uses=1]
-  %1 = load i64* %scevgep, align 8                ; <i64> [#uses=1]
-  %2 = add nsw i64 %1, %k.05                      ; <i64> [#uses=2]
-  %exitcond = icmp eq i64 %tmp6, %tmp             ; <i1> [#uses=1]
-  br i1 %exitcond, label %bb2, label %bb
-
-bb2:                                              ; preds = %bb, %entry
-  %k.0.lcssa = phi i64 [ 0, %entry ], [ %2, %bb ] ; <i64> [#uses=1]
-  ret i64 %k.0.lcssa
-}
-
-; CHECK:  Bounds of Loop: bb:   { (-2 + %n) }





More information about the llvm-commits mailing list