Index: polly/trunk/include/polly/ScopInfo.h =================================================================== --- polly/trunk/include/polly/ScopInfo.h +++ polly/trunk/include/polly/ScopInfo.h @@ -828,8 +828,9 @@ //@} /// @brief Return the (possibly new) ScopArrayInfo object for @p Access. - const ScopArrayInfo *getOrCreateScopArrayInfo(const IRAccess &Access, - Instruction *AccessInst); + const ScopArrayInfo * + getOrCreateScopArrayInfo(Value *BasePtr, Type *AccessType, + const SmallVector &Sizes); /// @brief Return the cached ScopArrayInfo object for @p BasePtr. const ScopArrayInfo *getScopArrayInfo(Value *BasePtr); Index: polly/trunk/include/polly/Support/ScopHelper.h =================================================================== --- polly/trunk/include/polly/Support/ScopHelper.h +++ polly/trunk/include/polly/Support/ScopHelper.h @@ -15,6 +15,7 @@ #define POLLY_SUPPORT_IRHELPER_H namespace llvm { +class Type; class Instruction; class LoopInfo; class Loop; @@ -52,6 +53,9 @@ llvm::Value *getPointerOperand(llvm::Instruction &Inst); llvm::BasicBlock *createSingleExitEdge(llvm::Region *R, llvm::Pass *P); +/// @brief Return the type of the access. +llvm::Type *getAccessInstType(llvm::Instruction *AccInst); + /// @brief Simplify the region in a SCoP to have a single unconditional entry /// edge and a single exit edge. /// Index: polly/trunk/lib/Analysis/ScopInfo.cpp =================================================================== --- polly/trunk/lib/Analysis/ScopInfo.cpp +++ polly/trunk/lib/Analysis/ScopInfo.cpp @@ -728,8 +728,10 @@ const IRAccess &Access = AccessPair.first; Instruction *AccessInst = AccessPair.second; - const ScopArrayInfo *SAI = - getParent()->getOrCreateScopArrayInfo(Access, AccessInst); + Type *AccessType = getAccessInstType(AccessInst)->getPointerTo(); + const ScopArrayInfo *SAI = getParent()->getOrCreateScopArrayInfo( + Access.getBase(), AccessType, Access.Sizes); + MemAccs.push_back(new MemoryAccess(Access, AccessInst, this, SAI)); // We do not track locations for scalar memory accesses at the moment. @@ -1482,14 +1484,12 @@ } } -const ScopArrayInfo *Scop::getOrCreateScopArrayInfo(const IRAccess &Access, - Instruction *AccessInst) { - Value *BasePtr = Access.getBase(); +const ScopArrayInfo * +Scop::getOrCreateScopArrayInfo(Value *BasePtr, Type *AccessType, + const SmallVector &Sizes) { const ScopArrayInfo *&SAI = ScopArrayInfoMap[BasePtr]; - if (!SAI) { - Type *AccessType = getPointerOperand(*AccessInst)->getType(); - SAI = new ScopArrayInfo(BasePtr, AccessType, getIslCtx(), Access.Sizes); - } + if (!SAI) + SAI = new ScopArrayInfo(BasePtr, AccessType, getIslCtx(), Sizes); return SAI; } Index: polly/trunk/lib/Support/ScopHelper.cpp =================================================================== --- polly/trunk/lib/Support/ScopHelper.cpp +++ polly/trunk/lib/Support/ScopHelper.cpp @@ -66,6 +66,12 @@ return 0; } +Type *polly::getAccessInstType(Instruction *AccInst) { + if (StoreInst *Store = dyn_cast(AccInst)) + return Store->getValueOperand()->getType(); + return AccInst->getType(); +} + bool polly::hasInvokeEdge(const PHINode *PN) { for (unsigned i = 0, e = PN->getNumIncomingValues(); i < e; ++i) if (InvokeInst *II = dyn_cast(PN->getIncomingValue(i)))