[polly] r247572 - Replace some SmallVector-typed parameters by ArrayRef

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 14 08:45:33 PDT 2015


Author: meinersbur
Date: Mon Sep 14 10:45:33 2015
New Revision: 247572

URL: http://llvm.org/viewvc/llvm-project?rev=247572&view=rev
Log:
Replace some SmallVector-typed parameters by ArrayRef

ArrayRef avoids making implementation details such as the number of stack elements to be part of the function signature.

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

Modified: polly/trunk/include/polly/ScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=247572&r1=247571&r2=247572&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Mon Sep 14 10:45:33 2015
@@ -112,8 +112,7 @@ public:
   /// @param IsPHI          Is this a PHI node specific array info object.
   /// @param S              The scop this array object belongs to.
   ScopArrayInfo(Value *BasePtr, Type *ElementType, isl_ctx *IslCtx,
-                const SmallVector<const SCEV *, 4> &DimensionSizes, bool IsPHI,
-                Scop *S);
+                ArrayRef<const SCEV *> DimensionSizes, bool IsPHI, Scop *S);
 
   /// @brief Destructor to free the isl id of the base pointer.
   ~ScopArrayInfo();
@@ -251,11 +250,12 @@ public:
 
   explicit IRAccess(TypeKind Type, Value *BaseAddress, const SCEV *Offset,
                     unsigned elemBytes, bool Affine,
-                    SmallVector<const SCEV *, 4> Subscripts,
-                    SmallVector<const SCEV *, 4> Sizes, Value *AccessValue)
+                    ArrayRef<const SCEV *> Subscripts,
+                    ArrayRef<const SCEV *> Sizes, Value *AccessValue)
       : BaseAddress(BaseAddress), AccessValue(AccessValue), Offset(Offset),
         ElemBytes(elemBytes), Type(Type), IsAffine(Affine), IsPHI(false),
-        Subscripts(Subscripts), Sizes(Sizes) {}
+        Subscripts(Subscripts.begin(), Subscripts.end()),
+        Sizes(Sizes.begin(), Sizes.end()) {}
 
   enum TypeKind getType() const { return Type; }
 
@@ -1291,10 +1291,10 @@ public:
   /// @param ElementType The type of the elements stored in this array.
   /// @param IsPHI       Is this ScopArrayInfo object modeling special
   ///                    PHI node storage.
-  const ScopArrayInfo *
-  getOrCreateScopArrayInfo(Value *BasePtr, Type *ElementType,
-                           const SmallVector<const SCEV *, 4> &Sizes,
-                           bool IsPHI = false);
+  const ScopArrayInfo *getOrCreateScopArrayInfo(Value *BasePtr,
+                                                Type *ElementType,
+                                                ArrayRef<const SCEV *> Sizes,
+                                                bool IsPHI = false);
 
   /// @brief Return the cached ScopArrayInfo object for @p BasePtr.
   ///

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=247572&r1=247571&r2=247572&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Mon Sep 14 10:45:33 2015
@@ -160,10 +160,11 @@ static const ScopArrayInfo *identifyBase
 }
 
 ScopArrayInfo::ScopArrayInfo(Value *BasePtr, Type *ElementType, isl_ctx *Ctx,
-                             const SmallVector<const SCEV *, 4> &DimensionSizes,
-                             bool IsPHI, Scop *S)
+                             ArrayRef<const SCEV *> DimensionSizes, bool IsPHI,
+                             Scop *S)
     : BasePtr(BasePtr), ElementType(ElementType),
-      DimensionSizes(DimensionSizes), IsPHI(IsPHI) {
+      DimensionSizes(DimensionSizes.begin(), DimensionSizes.end()),
+      IsPHI(IsPHI) {
   std::string BasePtrName =
       getIslCompatibleName("MemRef_", BasePtr, IsPHI ? "__phi" : "");
   Id = isl_id_alloc(Ctx, BasePtrName.c_str(), this);
@@ -2155,8 +2156,7 @@ Scop::~Scop() {
 
 const ScopArrayInfo *
 Scop::getOrCreateScopArrayInfo(Value *BasePtr, Type *AccessType,
-                               const SmallVector<const SCEV *, 4> &Sizes,
-                               bool IsPHI) {
+                               ArrayRef<const SCEV *> Sizes, bool IsPHI) {
   auto &SAI = ScopArrayInfoMap[std::make_pair(BasePtr, IsPHI)];
   if (!SAI)
     SAI.reset(new ScopArrayInfo(BasePtr, AccessType, getIslCtx(), Sizes, IsPHI,




More information about the llvm-commits mailing list