diff --git a/polly/include/polly/ScopInfo.h b/polly/include/polly/ScopInfo.h index d15a1f54c8c3..540136dd82d9 100644 --- a/polly/include/polly/ScopInfo.h +++ b/polly/include/polly/ScopInfo.h @@ -1181,11 +1181,11 @@ public: /// @brief Compute the isl representation for the SCEV @p /// - /// - /// @param Stmt An (optional) statement for which the isl_pw_aff is - /// computed. SCEVs known to not reference any loops in the - /// scop can be passed without a statement. - __isl_give isl_pw_aff *getPwAff(const SCEV *E, ScopStmt *Stmt = nullptr); + /// @param Domain An (optional) domain in which the isl_pw_aff is computed. + /// SCEVs known to not reference any loops in the SCoP can be + /// passed without a @p Domain. + __isl_give isl_pw_aff *getPwAff(const SCEV *E, + __isl_keep isl_set *Domain = nullptr); /// @brief Get a union set containing the iteration domains of all statements. __isl_give isl_union_set *getDomains() const; diff --git a/polly/include/polly/Support/SCEVAffinator.h b/polly/include/polly/Support/SCEVAffinator.h index 07957c24adfd..55ae359ce2fb 100644 --- a/polly/include/polly/Support/SCEVAffinator.h +++ b/polly/include/polly/Support/SCEVAffinator.h @@ -49,17 +49,16 @@ public: /// @brief Translate a SCEV to an isl_pw_aff. /// - /// @param E The expression that is translated. - /// @param Stmt The SCoP statement surrounding @p E or nullptr, if no - /// loop induction variables inside the scop are referenced. + /// @param E The expression that is translated. + /// @param Domain The domain in which @p E is executed. /// - /// @returns The isl representation of the SCEV @p E in @p Stmt. + /// @returns The isl representation of the SCEV @p E in @p Domain. __isl_give isl_pw_aff *getPwAff(const llvm::SCEV *E, - const ScopStmt *Stmt = nullptr); + __isl_keep isl_set *Domain = nullptr); private: /// @brief Key to identify cached expressions. - using CacheKey = std::pair; + using CacheKey = std::pair; /// @brief Map to remembered cached expressions. llvm::DenseMap CachedExpressions; @@ -69,7 +68,7 @@ private: unsigned NumIterators; const llvm::Region &R; llvm::ScalarEvolution &SE; - const ScopStmt *Stmt; + isl_set *Domain; __isl_give isl_pw_aff *visit(const llvm::SCEV *E); __isl_give isl_pw_aff *visitConstant(const llvm::SCEVConstant *E); diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp index fadcf50ff5b7..206e42b4576e 100644 --- a/polly/lib/Analysis/ScopInfo.cpp +++ b/polly/lib/Analysis/ScopInfo.cpp @@ -697,7 +697,7 @@ isl_map *ScopStmt::getSchedule() const { } __isl_give isl_pw_aff *ScopStmt::getPwAff(const SCEV *E) { - return getParent()->getPwAff(E, this); + return getParent()->getPwAff(E, Domain); } void ScopStmt::restrictDomain(__isl_take isl_set *NewDomain) { @@ -1843,8 +1843,8 @@ void Scop::dump() const { print(dbgs()); } isl_ctx *Scop::getIslCtx() const { return IslCtx; } -__isl_give isl_pw_aff *Scop::getPwAff(const SCEV *E, ScopStmt *Stmt) { - return Affinator.getPwAff(E, Stmt); +__isl_give isl_pw_aff *Scop::getPwAff(const SCEV *E, isl_set *Domain) { + return Affinator.getPwAff(E, Domain); } __isl_give isl_union_set *Scop::getDomains() const { diff --git a/polly/lib/Support/SCEVAffinator.cpp b/polly/lib/Support/SCEVAffinator.cpp index 79db71f52b72..86945da137c6 100644 --- a/polly/lib/Support/SCEVAffinator.cpp +++ b/polly/lib/Support/SCEVAffinator.cpp @@ -35,11 +35,11 @@ SCEVAffinator::~SCEVAffinator() { } __isl_give isl_pw_aff *SCEVAffinator::getPwAff(const SCEV *Expr, - const ScopStmt *Stmt) { - this->Stmt = Stmt; + isl_set *Domain) { + this->Domain = Domain; - if (Stmt) - NumIterators = Stmt->getNumIterators(); + if (Domain) + NumIterators = isl_set_n_dim(Domain); else NumIterators = 0; @@ -50,7 +50,7 @@ __isl_give isl_pw_aff *SCEVAffinator::getPwAff(const SCEV *Expr, __isl_give isl_pw_aff *SCEVAffinator::visit(const SCEV *Expr) { - auto Key = std::make_pair(Expr, Stmt); + auto Key = std::make_pair(Expr, Domain); isl_pw_aff *PWA = CachedExpressions[Key]; if (PWA)