[polly] r312114 - [ScopBuilder/ScopInfo] Move and inline Scop::init into ScopBuilder::buildScop. NFC.

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 30 06:04:39 PDT 2017


Author: meinersbur
Date: Wed Aug 30 06:04:39 2017
New Revision: 312114

URL: http://llvm.org/viewvc/llvm-project?rev=312114&view=rev
Log:
[ScopBuilder/ScopInfo] Move and inline Scop::init into ScopBuilder::buildScop. NFC.

The method is only needed in the SCoP building phase, and doesn't need
to be part of the general API.

Modified:
    polly/trunk/include/polly/ScopInfo.h
    polly/trunk/lib/Analysis/ScopBuilder.cpp
    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=312114&r1=312113&r2=312114&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Wed Aug 30 06:04:39 2017
@@ -1189,6 +1189,8 @@ using InvariantEquivClassesTy = SmallVec
 /// accesses.
 /// At the moment every statement represents a single basic block of LLVM-IR.
 class ScopStmt {
+  friend class ScopBuilder;
+
 public:
   /// Create the ScopStmt from a BasicBlock.
   ScopStmt(Scop &parent, BasicBlock &bb, Loop *SurroundingLoop,
@@ -1211,9 +1213,6 @@ public:
   const ScopStmt &operator=(const ScopStmt &) = delete;
   ~ScopStmt();
 
-  /// Initialize members after all MemoryAccesses have been added.
-  void init(LoopInfo &LI);
-
 private:
   /// Polyhedral description
   //@{

Modified: polly/trunk/lib/Analysis/ScopBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopBuilder.cpp?rev=312114&r1=312113&r2=312114&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopBuilder.cpp (original)
+++ polly/trunk/lib/Analysis/ScopBuilder.cpp Wed Aug 30 06:04:39 2017
@@ -89,6 +89,11 @@ static cl::opt<bool> DetectFortranArrays
     cl::desc("Detect Fortran arrays and use this for code generation"),
     cl::Hidden, cl::init(false), cl::cat(PollyCategory));
 
+static cl::opt<bool> DetectReductions("polly-detect-reductions",
+                                      cl::desc("Detect and exploit reductions"),
+                                      cl::Hidden, cl::ZeroOrMore,
+                                      cl::init(true), cl::cat(PollyCategory));
+
 void ScopBuilder::buildPHIAccesses(ScopStmt *PHIStmt, PHINode *PHI,
                                    Region *NonAffineSubRegion,
                                    bool IsExitBlock) {
@@ -1042,8 +1047,14 @@ void ScopBuilder::buildScop(Region &R, A
   }
 
   // The ScopStmts now have enough information to initialize themselves.
-  for (ScopStmt &Stmt : *scop)
-    Stmt.init(LI);
+  for (ScopStmt &Stmt : *scop) {
+    Stmt.buildDomain();
+    Stmt.collectSurroundingLoops();
+    Stmt.buildAccessRelations();
+
+    if (DetectReductions)
+      Stmt.checkForReductions();
+  }
 
   // Check early for a feasible runtime context.
   if (!scop->hasFeasibleRuntimeContext()) {

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=312114&r1=312113&r2=312114&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Wed Aug 30 06:04:39 2017
@@ -203,11 +203,6 @@ static cl::opt<std::string> UserContextS
     cl::desc("Provide additional constraints on the context parameters"),
     cl::init(""), cl::cat(PollyCategory));
 
-static cl::opt<bool> DetectReductions("polly-detect-reductions",
-                                      cl::desc("Detect and exploit reductions"),
-                                      cl::Hidden, cl::ZeroOrMore,
-                                      cl::init(true), cl::cat(PollyCategory));
-
 static cl::opt<bool>
     IslOnErrorAbort("polly-on-isl-error-abort",
                     cl::desc("Abort if an isl error is encountered"),
@@ -1796,17 +1791,6 @@ ScopStmt::ScopStmt(Scop &parent, isl::ma
 
 ScopStmt::~ScopStmt() = default;
 
-void ScopStmt::init(LoopInfo &LI) {
-  assert(!Domain && "init must be called only once");
-
-  buildDomain();
-  collectSurroundingLoops();
-  buildAccessRelations();
-
-  if (DetectReductions)
-    checkForReductions();
-}
-
 /// Collect loads which might form a reduction chain with @p StoreMA.
 ///
 /// Check if the stored value for @p StoreMA is a binary operator with one or




More information about the llvm-commits mailing list