diff options
-rw-r--r-- | polly/include/polly/ScopInfo.h | 3 | ||||
-rw-r--r-- | polly/lib/Analysis/ScopInfo.cpp | 13 |
2 files changed, 12 insertions, 4 deletions
diff --git a/polly/include/polly/ScopInfo.h b/polly/include/polly/ScopInfo.h index f0f078f1173..5c102e0766d 100644 --- a/polly/include/polly/ScopInfo.h +++ b/polly/include/polly/ScopInfo.h @@ -797,6 +797,9 @@ public: /// @brief Return the access function subscript in the dimension @p Dim. const SCEV *getSubscript(unsigned Dim) const { return Subscripts[Dim]; } + /// @brief Compute the isl representation for the SCEV @p E wrt. this access. + __isl_give isl_pw_aff *getPwAff(const SCEV *E); + /// Get the stride of this memory access in the specified Schedule. Schedule /// is a map from the statement to a schedule where the innermost dimension is /// the dimension of the innermost loop containing the statement. diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp index 7f632a91b4f..14e673cb7b4 100644 --- a/polly/lib/Analysis/ScopInfo.cpp +++ b/polly/lib/Analysis/ScopInfo.cpp @@ -676,14 +676,14 @@ void MemoryAccess::buildMemIntrinsicAccessRelation() { assert(isa<MemIntrinsic>(getAccessInstruction())); assert(Subscripts.size() == 2 && Sizes.size() == 0); - auto *SubscriptPWA = Statement->getPwAff(Subscripts[0]); + auto *SubscriptPWA = getPwAff(Subscripts[0]); auto *SubscriptMap = isl_map_from_pw_aff(SubscriptPWA); isl_map *LengthMap; if (Subscripts[1] == nullptr) { LengthMap = isl_map_universe(isl_map_get_space(SubscriptMap)); } else { - auto *LengthPWA = Statement->getPwAff(Subscripts[1]); + auto *LengthPWA = getPwAff(Subscripts[1]); LengthMap = isl_map_from_pw_aff(LengthPWA); auto *RangeSpace = isl_space_range(isl_map_get_space(LengthMap)); LengthMap = isl_map_apply_range(LengthMap, isl_map_lex_gt(RangeSpace)); @@ -742,7 +742,7 @@ __isl_give isl_map *MemoryAccess::foldAccess(__isl_take isl_map *AccessRelation, for (int i = Size - 2; i >= 0; --i) { isl_space *Space; isl_map *MapOne, *MapTwo; - isl_pw_aff *DimSize = Statement->getPwAff(Sizes[i]); + isl_pw_aff *DimSize = getPwAff(Sizes[i]); isl_space *SpaceSize = isl_pw_aff_get_space(DimSize); isl_pw_aff_free(DimSize); @@ -840,7 +840,7 @@ void MemoryAccess::buildAccessRelation(const ScopArrayInfo *SAI) { AccessRelation = isl_map_universe(Space); for (int i = 0, Size = Subscripts.size(); i < Size; ++i) { - isl_pw_aff *Affine = Statement->getPwAff(Subscripts[i]); + isl_pw_aff *Affine = getPwAff(Subscripts[i]); isl_map *SubscriptMap = isl_map_from_pw_aff(Affine); AccessRelation = isl_map_flat_range_product(AccessRelation, SubscriptMap); } @@ -919,6 +919,11 @@ void MemoryAccess::print(raw_ostream &OS) const { void MemoryAccess::dump() const { print(errs()); } +__isl_give isl_pw_aff *MemoryAccess::getPwAff(const SCEV *E) { + auto *Stmt = getStatement(); + return Stmt->getParent()->getPwAff(E, Stmt->getEntryBlock()); +} + // Create a map in the size of the provided set domain, that maps from the // one element of the provided set domain to another element of the provided // set domain. |