[polly] r246290 - [NFC] Make SCEVAffinator work without a statement

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 28 02:24:35 PDT 2015


Author: jdoerfert
Date: Fri Aug 28 04:24:35 2015
New Revision: 246290

URL: http://llvm.org/viewvc/llvm-project?rev=246290&view=rev
Log:
[NFC] Make SCEVAffinator work without a statement

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

Modified: polly/trunk/include/polly/ScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=246290&r1=246289&r2=246290&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Fri Aug 28 04:24:35 2015
@@ -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;

Modified: polly/trunk/include/polly/Support/SCEVAffinator.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/Support/SCEVAffinator.h?rev=246290&r1=246289&r2=246290&view=diff
==============================================================================
--- polly/trunk/include/polly/Support/SCEVAffinator.h (original)
+++ polly/trunk/include/polly/Support/SCEVAffinator.h Fri Aug 28 04:24:35 2015
@@ -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<const llvm::SCEV *, const ScopStmt *>;
+  using CacheKey = std::pair<const llvm::SCEV *, isl_set *>;
 
   /// @brief Map to remembered cached expressions.
   llvm::DenseMap<CacheKey, isl_pw_aff *> 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);

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=246290&r1=246289&r2=246290&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Fri Aug 28 04:24:35 2015
@@ -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 {

Modified: polly/trunk/lib/Support/SCEVAffinator.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/SCEVAffinator.cpp?rev=246290&r1=246289&r2=246290&view=diff
==============================================================================
--- polly/trunk/lib/Support/SCEVAffinator.cpp (original)
+++ polly/trunk/lib/Support/SCEVAffinator.cpp Fri Aug 28 04:24:35 2015
@@ -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::ge
 
 __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)




More information about the llvm-commits mailing list