[PATCH] D36303: [Polly][PM] Make the new-pm passes behave more like the legacy passes

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 4 04:29:54 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL310052: [PM] Make the new-pm passes behave more like the legacy passes (authored by pfaffe).

Changed prior to commit:
  https://reviews.llvm.org/D36303?vs=109689&id=109706#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D36303

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


Index: polly/trunk/lib/Analysis/ScopDetection.cpp
===================================================================
--- polly/trunk/lib/Analysis/ScopDetection.cpp
+++ polly/trunk/lib/Analysis/ScopDetection.cpp
@@ -1804,6 +1804,7 @@
 
 PreservedAnalyses ScopAnalysisPrinterPass::run(Function &F,
                                                FunctionAnalysisManager &FAM) {
+  Stream << "Detected Scops in Function " << F.getName() << "\n";
   auto &SD = FAM.getResult<ScopAnalysis>(F);
   for (const Region *R : SD.ValidRegions)
     Stream << "Valid Region for Scop: " << R->getNameStr() << '\n';
Index: polly/trunk/lib/Analysis/ScopInfo.cpp
===================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp
+++ polly/trunk/lib/Analysis/ScopInfo.cpp
@@ -5290,7 +5290,9 @@
 PreservedAnalyses ScopInfoPrinterPass::run(Function &F,
                                            FunctionAnalysisManager &FAM) {
   auto &SI = FAM.getResult<ScopInfoAnalysis>(F);
-  for (auto &It : SI) {
+  // Since the legacy PM processes Scops in bottom up, we print them in reverse
+  // order here to keep the output persistent
+  for (auto &It : reverse(SI)) {
     if (It.second)
       It.second->print(Stream, PollyPrintInstructions);
     else
Index: polly/trunk/include/polly/ScopInfo.h
===================================================================
--- polly/trunk/include/polly/ScopInfo.h
+++ polly/trunk/include/polly/ScopInfo.h
@@ -3029,7 +3029,9 @@
 
 class ScopInfo {
 public:
-  using RegionToScopMapTy = DenseMap<Region *, std::unique_ptr<Scop>>;
+  using RegionToScopMapTy = MapVector<Region *, std::unique_ptr<Scop>>;
+  using reverse_iterator = RegionToScopMapTy::reverse_iterator;
+  using const_reverse_iterator = RegionToScopMapTy::const_reverse_iterator;
   using iterator = RegionToScopMapTy::iterator;
   using const_iterator = RegionToScopMapTy::const_iterator;
 
@@ -3060,6 +3062,10 @@
   iterator end() { return RegionToScopMap.end(); }
   const_iterator begin() const { return RegionToScopMap.begin(); }
   const_iterator end() const { return RegionToScopMap.end(); }
+  reverse_iterator rbegin() { return RegionToScopMap.rbegin(); }
+  reverse_iterator rend() { return RegionToScopMap.rend(); }
+  const_reverse_iterator rbegin() const { return RegionToScopMap.rbegin(); }
+  const_reverse_iterator rend() const { return RegionToScopMap.rend(); }
   bool empty() const { return RegionToScopMap.empty(); }
 };
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36303.109706.patch
Type: text/x-patch
Size: 2473 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170804/4e432fe4/attachment.bin>


More information about the llvm-commits mailing list