[PM] Make the new-pm passes behave more like the legacy passes
Summary:
Testing the new-pm passes becomes much easier once they behave more like the
old passes in terms of the order in which Scops are processed and printed. This
requires three changes:
- ScopInfo: Use an ordered map to store scops
- ScopInfo: Iterate and print Scops in reverse order to match legacy PM behaviour
- ScopDetection: print function name in ScopAnalysisPrinter
Reviewers: grosser, Meinersbur, bollu
Reviewed By: grosser
Subscribers: pollydev, llvm-commits
Differential Revision: https://reviews.llvm.org/D36303
llvm-svn: 310052
diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp
index 1da1625..515a505 100644
--- a/polly/lib/Analysis/ScopInfo.cpp
+++ b/polly/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