[llvm-commits] [polly] r144279 - in /polly/trunk: include/polly/TempScopInfo.h lib/Analysis/ScopInfo.cpp lib/Analysis/TempScopInfo.cpp

Tobias Grosser grosser at fim.uni-passau.de
Thu Nov 10 04:44:55 PST 2011


Author: grosser
Date: Thu Nov 10 06:44:55 2011
New Revision: 144279

URL: http://llvm.org/viewvc/llvm-project?rev=144279&view=rev
Log:
Use getBasePtr in TempScop/ScopInfo

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=144279&r1=144278&r2=144279&view=diff
==============================================================================
--- polly/trunk/include/polly/TempScopInfo.h (original)
+++ polly/trunk/include/polly/TempScopInfo.h Thu Nov 10 06:44:55 2011
@@ -35,8 +35,9 @@
 /// @brief A memory access described by a SCEV expression and the access type.
 class IRAccess {
 public:
-  // The SCEV of this memory access.
-  const SCEV *Scev;
+  const Value *BaseAddress;
+
+  const SCEV *Offset;
 
   // The type of the scev affine function
   enum TypeKind { READ, WRITE };
@@ -46,12 +47,16 @@
   TypeKind Type;
 
 public:
-  explicit IRAccess (TypeKind Type, const SCEV *Scev, unsigned elemBytes)
-    : Scev(Scev), ElemBytes(elemBytes), Type(Type) {}
+  explicit IRAccess (TypeKind Type, const Value *BaseAddress,
+                     const SCEV *Offset, unsigned elemBytes)
+    : BaseAddress(BaseAddress), Offset(Offset),
+      ElemBytes(elemBytes), Type(Type) {}
 
   enum TypeKind getType() const { return Type; }
 
-  const SCEV *getSCEV() const { return Scev; }
+  const Value *getBase() const { return BaseAddress; }
+
+  const SCEV *getOffset() const { return Offset; }
 
   unsigned getElemSizeInBytes() const { return ElemBytes; }
 

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=144279&r1=144278&r2=144279&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Thu Nov 10 06:44:55 2011
@@ -329,10 +329,8 @@
   Type = Access.isRead() ? Read : Write;
   statement = Statement;
 
-  Value *TmpBaseAddress = NULL;
-  isl_pw_aff *Affine = SCEVAffinator::getPwAff(Statement, Access.getSCEV(),
-                                               &TmpBaseAddress);
-  BaseAddr = TmpBaseAddress;
+  isl_pw_aff *Affine = SCEVAffinator::getPwAff(Statement, Access.getOffset());
+  BaseAddr = Access.getBase();
 
   setBaseName();
 

Modified: polly/trunk/lib/Analysis/TempScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/TempScopInfo.cpp?rev=144279&r1=144278&r2=144279&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/TempScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/TempScopInfo.cpp Thu Nov 10 06:44:55 2011
@@ -26,6 +26,7 @@
 #include "llvm/Assembly/Writer.h"
 #include "llvm/Analysis/LoopInfo.h"
 #include "llvm/Analysis/ScalarEvolution.h"
+#include "llvm/Analysis/ScalarEvolutionExpressions.h"
 #include "llvm/ADT/STLExtras.h"
 
 #define DEBUG_TYPE "polly-analyze-ir"
@@ -93,7 +94,13 @@
       }
 
       const SCEV *AccessFunction = SE->getSCEV(getPointerOperand(Inst));
-      Functions.push_back(std::make_pair(IRAccess(Type, AccessFunction, Size),
+      const SCEVUnknown *BasePointer =
+        static_cast<const SCEVUnknown*>(SE->getPointerBase(AccessFunction));
+
+      AccessFunction = SE->getMinusSCEV(AccessFunction, BasePointer);
+      Functions.push_back(std::make_pair(IRAccess(Type,
+                                                  BasePointer->getValue(),
+                                                  AccessFunction, Size),
                                          &Inst));
     }
   }





More information about the llvm-commits mailing list