[polly] r249609 - [NFC] Make LoopInfo a member and simplify arguments

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 7 13:31:36 PDT 2015


Author: jdoerfert
Date: Wed Oct  7 15:31:36 2015
New Revision: 249609

URL: http://llvm.org/viewvc/llvm-project?rev=249609&view=rev
Log:
[NFC] Make LoopInfo a member and simplify arguments

Modified:
    polly/trunk/include/polly/ScopInfo.h
    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=249609&r1=249608&r2=249609&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Wed Oct  7 15:31:36 2015
@@ -1005,6 +1005,7 @@ private:
   Scop(const Scop &) = delete;
   const Scop &operator=(const Scop &) = delete;
 
+  LoopInfo &LI;
   DominatorTree &DT;
   ScalarEvolution *SE;
 
@@ -1138,39 +1139,31 @@ private:
 
   /// @brief Scop constructor; invoked from ScopInfo::buildScop.
   Scop(Region &R, AccFuncMapType &AccFuncMap, ScopDetection &SD,
-       ScalarEvolution &SE, DominatorTree &DT, isl_ctx *ctx,
+       ScalarEvolution &SE, DominatorTree &DT, LoopInfo &LI, isl_ctx *ctx,
        unsigned MaxLoopDepth);
 
   /// @brief Initialize this ScopInfo .
-  void init(LoopInfo &LI, AliasAnalysis &AA);
+  void init(AliasAnalysis &AA);
 
   /// @brief Add loop carried constraints to the header block of the loop @p L.
   ///
   /// @param L  The loop to process.
-  /// @param LI The LoopInfo analysis.
-  void addLoopBoundsToHeaderDomain(Loop *L, LoopInfo &LI);
+  void addLoopBoundsToHeaderDomain(Loop *L);
 
   /// @brief Compute the branching constraints for each basic block in @p R.
   ///
   /// @param R  The region we currently build branching conditions for.
-  /// @param LI The LoopInfo analysis to obtain the number of iterators.
-  /// @param DT The dominator tree of the current function.
-  void buildDomainsWithBranchConstraints(Region *R, LoopInfo &LI,
-                                         DominatorTree &DT);
+  void buildDomainsWithBranchConstraints(Region *R);
 
   /// @brief Propagate the domain constraints through the region @p R.
   ///
   /// @param R  The region we currently build branching conditions for.
-  /// @param LI The LoopInfo analysis to obtain the number of iterators.
-  /// @param DT The dominator tree of the current function.
-  void propagateDomainConstraints(Region *R, LoopInfo &LI, DominatorTree &DT);
+  void propagateDomainConstraints(Region *R);
 
   /// @brief Compute the domain for each basic block in @p R.
   ///
   /// @param R  The region we currently traverse.
-  /// @param LI The LoopInfo analysis to argue about the number of iterators.
-  /// @param DT The dominator tree of the current function.
-  void buildDomains(Region *R, LoopInfo &LI, DominatorTree &DT);
+  void buildDomains(Region *R);
 
   /// @brief Check if a region part should be represented in the SCoP or not.
   ///
@@ -1248,10 +1241,9 @@ private:
   /// @brief Build Schedule and ScopStmts.
   ///
   /// @param R              The current region traversed.
-  /// @param LI             The LoopInfo object.
   /// @param LoopSchedules  Map from loops to their schedule and progress.
   void buildSchedule(
-      Region *R, LoopInfo &LI,
+      Region *R,
       DenseMap<Loop *, std::pair<isl_schedule *, unsigned>> &LoopSchedules);
 
   /// @name Helper function for printing the Scop.

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=249609&r1=249608&r2=249609&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Wed Oct  7 15:31:36 2015
@@ -1728,7 +1728,7 @@ isl_set *Scop::getDomainConditions(Basic
   return isl_set_copy(DomainMap[BB]);
 }
 
-void Scop::buildDomains(Region *R, LoopInfo &LI, DominatorTree &DT) {
+void Scop::buildDomains(Region *R) {
 
   auto *EntryBB = R->getEntry();
   int LD = getRelativeLoopDepth(LI.getLoopFor(EntryBB));
@@ -1745,12 +1745,11 @@ void Scop::buildDomains(Region *R, LoopI
   if (SD.isNonAffineSubRegion(R, R))
     return;
 
-  buildDomainsWithBranchConstraints(R, LI, DT);
-  propagateDomainConstraints(R, LI, DT);
+  buildDomainsWithBranchConstraints(R);
+  propagateDomainConstraints(R);
 }
 
-void Scop::buildDomainsWithBranchConstraints(Region *R, LoopInfo &LI,
-                                             DominatorTree &DT) {
+void Scop::buildDomainsWithBranchConstraints(Region *R) {
   RegionInfo &RI = *R->getRegionInfo();
 
   // To create the domain for each block in R we iterate over all blocks and
@@ -1772,7 +1771,7 @@ void Scop::buildDomainsWithBranchConstra
     if (RN->isSubRegion()) {
       Region *SubRegion = RN->getNodeAs<Region>();
       if (!SD.isNonAffineSubRegion(SubRegion, &getRegion())) {
-        buildDomainsWithBranchConstraints(SubRegion, LI, DT);
+        buildDomainsWithBranchConstraints(SubRegion);
         continue;
       }
     }
@@ -1894,8 +1893,7 @@ getDomainForBlock(BasicBlock *BB, DenseM
   return getDomainForBlock(R->getEntry(), DomainMap, RI);
 }
 
-void Scop::propagateDomainConstraints(Region *R, LoopInfo &LI,
-                                      DominatorTree &DT) {
+void Scop::propagateDomainConstraints(Region *R) {
   // Iterate over the region R and propagate the domain constrains from the
   // predecessors to the current node. In contrast to the
   // buildDomainsWithBranchConstraints function, this one will pull the domain
@@ -1916,7 +1914,7 @@ void Scop::propagateDomainConstraints(Re
     if (RN->isSubRegion()) {
       Region *SubRegion = RN->getNodeAs<Region>();
       if (!SD.isNonAffineSubRegion(SubRegion, &getRegion())) {
-        propagateDomainConstraints(SubRegion, LI, DT);
+        propagateDomainConstraints(SubRegion);
         continue;
       }
     }
@@ -1992,7 +1990,7 @@ void Scop::propagateDomainConstraints(Re
     Domain = isl_set_coalesce(isl_set_intersect(Domain, PredDom));
 
     if (BBLoop && BBLoop->getHeader() == BB && getRegion().contains(BBLoop))
-      addLoopBoundsToHeaderDomain(BBLoop, LI);
+      addLoopBoundsToHeaderDomain(BBLoop);
 
     // Add assumptions for error blocks.
     if (containsErrorBlock(RN)) {
@@ -2023,7 +2021,7 @@ createNextIterationMap(__isl_take isl_sp
   return NextIterationMap;
 }
 
-void Scop::addLoopBoundsToHeaderDomain(Loop *L, LoopInfo &LI) {
+void Scop::addLoopBoundsToHeaderDomain(Loop *L) {
   int LoopDepth = getRelativeLoopDepth(L);
   assert(LoopDepth >= 0 && "Loop in region should have at least depth one");
 
@@ -2308,17 +2306,17 @@ static unsigned getMaxLoopDepthInRegion(
 }
 
 Scop::Scop(Region &R, AccFuncMapType &AccFuncMap, ScopDetection &SD,
-           ScalarEvolution &ScalarEvolution, DominatorTree &DT,
+           ScalarEvolution &ScalarEvolution, DominatorTree &DT, LoopInfo &LI,
            isl_ctx *Context, unsigned MaxLoopDepth)
-    : DT(DT), SE(&ScalarEvolution), SD(SD), R(R), AccFuncMap(AccFuncMap),
-      IsOptimized(false), HasSingleExitEdge(R.getExitingBlock()),
-      MaxLoopDepth(MaxLoopDepth), IslCtx(Context), Context(nullptr),
-      Affinator(this), AssumedContext(nullptr), BoundaryContext(nullptr),
-      Schedule(nullptr) {}
+    : LI(LI), DT(DT), SE(&ScalarEvolution), SD(SD), R(R),
+      AccFuncMap(AccFuncMap), IsOptimized(false),
+      HasSingleExitEdge(R.getExitingBlock()), MaxLoopDepth(MaxLoopDepth),
+      IslCtx(Context), Context(nullptr), Affinator(this),
+      AssumedContext(nullptr), BoundaryContext(nullptr), Schedule(nullptr) {}
 
-void Scop::init(LoopInfo &LI, AliasAnalysis &AA) {
+void Scop::init(AliasAnalysis &AA) {
   buildContext();
-  buildDomains(&R, LI, DT);
+  buildDomains(&R);
 
   // Remove empty and ignored statements.
   // Exit early in case there are no executable statements left in this scop.
@@ -2333,7 +2331,7 @@ void Scop::init(LoopInfo &LI, AliasAnaly
   DenseMap<Loop *, std::pair<isl_schedule *, unsigned>> LoopSchedules;
   Loop *L = getLoopSurroundingRegion(R, LI);
   LoopSchedules[L];
-  buildSchedule(&R, LI, LoopSchedules);
+  buildSchedule(&R, LoopSchedules);
   updateAccessDimensionality();
   Schedule = LoopSchedules[L].first;
 
@@ -2971,7 +2969,7 @@ ScopStmt *Scop::addScopStmt(BasicBlock *
 }
 
 void Scop::buildSchedule(
-    Region *R, LoopInfo &LI,
+    Region *R,
     DenseMap<Loop *, std::pair<isl_schedule *, unsigned>> &LoopSchedules) {
 
   if (SD.isNonAffineSubRegion(R, &getRegion())) {
@@ -2991,7 +2989,7 @@ void Scop::buildSchedule(
     if (RN->isSubRegion()) {
       Region *SubRegion = RN->getNodeAs<Region>();
       if (!SD.isNonAffineSubRegion(SubRegion, &getRegion())) {
-        buildSchedule(SubRegion, LI, LoopSchedules);
+        buildSchedule(SubRegion, LoopSchedules);
         continue;
       }
     }
@@ -3440,7 +3438,7 @@ void ScopInfo::addPHIReadAccess(PHINode
 
 void ScopInfo::buildScop(Region &R, DominatorTree &DT) {
   unsigned MaxLoopDepth = getMaxLoopDepthInRegion(R, *LI, *SD);
-  scop = new Scop(R, AccFuncMap, *SD, *SE, DT, ctx, MaxLoopDepth);
+  scop = new Scop(R, AccFuncMap, *SD, *SE, DT, *LI, ctx, MaxLoopDepth);
 
   buildStmts(R);
   buildAccessFunctions(R, R);
@@ -3455,7 +3453,7 @@ void ScopInfo::buildScop(Region &R, Domi
   if (!R.getExitingBlock())
     buildAccessFunctions(R, *R.getExit(), nullptr, /* IsExitBlock */ true);
 
-  scop->init(*LI, *AA);
+  scop->init(*AA);
 }
 
 void ScopInfo::print(raw_ostream &OS, const Module *) const {




More information about the llvm-commits mailing list