[PATCH] D75089: [polly] Don't count scops in a global variable.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 24 17:13:02 PST 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG888b12b270f3: [polly] Don't count scops in a global variable. (authored by efriedma).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75089/new/

https://reviews.llvm.org/D75089

Files:
  polly/include/polly/ScopDetection.h
  polly/include/polly/ScopInfo.h
  polly/lib/Analysis/ScopBuilder.cpp
  polly/lib/Analysis/ScopInfo.cpp


Index: polly/lib/Analysis/ScopInfo.cpp
===================================================================
--- polly/lib/Analysis/ScopInfo.cpp
+++ polly/lib/Analysis/ScopInfo.cpp
@@ -1692,25 +1692,12 @@
   return getDomainConditions(BBR->getEntry());
 }
 
-int Scop::NextScopID = 0;
-
-std::string Scop::CurrentFunc;
-
-int Scop::getNextID(std::string ParentFunc) {
-  if (ParentFunc != CurrentFunc) {
-    CurrentFunc = ParentFunc;
-    NextScopID = 0;
-  }
-  return NextScopID++;
-}
-
 Scop::Scop(Region &R, ScalarEvolution &ScalarEvolution, LoopInfo &LI,
            DominatorTree &DT, ScopDetection::DetectionContext &DC,
-           OptimizationRemarkEmitter &ORE)
+           OptimizationRemarkEmitter &ORE, int ID)
     : IslCtx(isl_ctx_alloc(), isl_ctx_free), SE(&ScalarEvolution), DT(&DT),
       R(R), name(None), HasSingleExitEdge(R.getExitingBlock()), DC(DC),
-      ORE(ORE), Affinator(this, LI),
-      ID(getNextID((*R.getEntry()->getParent()).getName().str())) {
+      ORE(ORE), Affinator(this, LI), ID(ID) {
   if (IslOnErrorAbort)
     isl_options_set_on_error(getIslCtx().get(), ISL_ON_ERROR_ABORT);
   buildContext();
Index: polly/lib/Analysis/ScopBuilder.cpp
===================================================================
--- polly/lib/Analysis/ScopBuilder.cpp
+++ polly/lib/Analysis/ScopBuilder.cpp
@@ -3631,7 +3631,8 @@
 #endif
 
 void ScopBuilder::buildScop(Region &R, AssumptionCache &AC) {
-  scop.reset(new Scop(R, SE, LI, DT, *SD.getDetectionContext(&R), ORE));
+  scop.reset(new Scop(R, SE, LI, DT, *SD.getDetectionContext(&R), ORE,
+                      SD.getNextID()));
 
   buildStmts(R);
 
Index: polly/include/polly/ScopInfo.h
===================================================================
--- polly/include/polly/ScopInfo.h
+++ polly/include/polly/ScopInfo.h
@@ -1709,12 +1709,6 @@
   /// The name of the SCoP (identical to the regions name)
   Optional<std::string> name;
 
-  /// The ID to be assigned to the next Scop in a function
-  static int NextScopID;
-
-  /// The name of the function currently under consideration
-  static std::string CurrentFunc;
-
   // Access functions of the SCoP.
   //
   // This owns all the MemoryAccess objects of the Scop created in this pass.
@@ -1899,12 +1893,10 @@
   DenseMap<const ScopArrayInfo *, SmallVector<MemoryAccess *, 4>>
       PHIIncomingAccs;
 
-  /// Return the ID for a new Scop within a function
-  static int getNextID(std::string ParentFunc);
-
   /// Scop constructor; invoked from ScopBuilder::buildScop.
   Scop(Region &R, ScalarEvolution &SE, LoopInfo &LI, DominatorTree &DT,
-       ScopDetection::DetectionContext &DC, OptimizationRemarkEmitter &ORE);
+       ScopDetection::DetectionContext &DC, OptimizationRemarkEmitter &ORE,
+       int ID);
 
   //@}
 
Index: polly/include/polly/ScopDetection.h
===================================================================
--- polly/include/polly/ScopDetection.h
+++ polly/include/polly/ScopDetection.h
@@ -185,6 +185,9 @@
     int MaxDepth;
   };
 
+  int NextScopID = 0;
+  int getNextID() { return NextScopID++; }
+
 private:
   //===--------------------------------------------------------------------===//
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75089.246348.patch
Type: text/x-patch
Size: 3174 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200225/28e6387c/attachment.bin>


More information about the llvm-commits mailing list