[llvm] ce22b7f - [NPM] Fix LoopNestPasses in -print-pipeline-passes
Markus Lavin via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 30 22:58:43 PST 2021
Author: Markus Lavin
Date: 2021-12-01T07:57:17+01:00
New Revision: ce22b7f17b6a8ccf09a07eb9bda964cf1b007e0d
URL: https://github.com/llvm/llvm-project/commit/ce22b7f17b6a8ccf09a07eb9bda964cf1b007e0d
DIFF: https://github.com/llvm/llvm-project/commit/ce22b7f17b6a8ccf09a07eb9bda964cf1b007e0d.diff
LOG: [NPM] Fix LoopNestPasses in -print-pipeline-passes
Fix printing of LoopNestPasses when using the opt pipeline printer
option -print-pipeline-passes.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D114771
Added:
Modified:
llvm/lib/Transforms/Scalar/LoopPassManager.cpp
llvm/test/Other/new-pm-print-pipeline.ll
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/LoopPassManager.cpp b/llvm/lib/Transforms/Scalar/LoopPassManager.cpp
index 3df4cfe8e4c13..6c783848432b4 100644
--- a/llvm/lib/Transforms/Scalar/LoopPassManager.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopPassManager.cpp
@@ -49,9 +49,17 @@ void PassManager<Loop, LoopAnalysisManager, LoopStandardAnalysisResults &,
LPMUpdater &>::printPipeline(raw_ostream &OS,
function_ref<StringRef(StringRef)>
MapClassName2PassName) {
- for (unsigned Idx = 0, Size = LoopPasses.size(); Idx != Size; ++Idx) {
- auto *P = LoopPasses[Idx].get();
- P->printPipeline(OS, MapClassName2PassName);
+ assert(LoopPasses.size() + LoopNestPasses.size() == IsLoopNestPass.size());
+
+ unsigned IdxLP = 0, IdxLNP = 0;
+ for (unsigned Idx = 0, Size = IsLoopNestPass.size(); Idx != Size; ++Idx) {
+ if (IsLoopNestPass[Idx]) {
+ auto *P = LoopNestPasses[IdxLNP++].get();
+ P->printPipeline(OS, MapClassName2PassName);
+ } else {
+ auto *P = LoopPasses[IdxLP++].get();
+ P->printPipeline(OS, MapClassName2PassName);
+ }
if (Idx + 1 < Size)
OS << ",";
}
diff --git a/llvm/test/Other/new-pm-print-pipeline.ll b/llvm/test/Other/new-pm-print-pipeline.ll
index da06e93080512..ac0a1a06b7e71 100644
--- a/llvm/test/Other/new-pm-print-pipeline.ll
+++ b/llvm/test/Other/new-pm-print-pipeline.ll
@@ -69,3 +69,7 @@
; RUN: opt -disable-output -disable-verify -print-pipeline-passes -passes='cgscc(function<eager-inv>(no-op-function)),function<eager-inv>(no-op-function)' < %s | FileCheck %s --match-full-lines --check-prefixes=CHECK-22
; CHECK-22: cgscc(function<eager-inv>(no-op-function)),function<eager-inv>(no-op-function)
+
+;; Test that the loop-nest-pass lnicm is printed with the other loop-passes in the pipeline.
+; RUN: opt -disable-output -disable-verify -print-pipeline-passes -passes='function(loop-mssa(licm,loop-rotate,loop-deletion,lnicm,loop-rotate))' < %s | FileCheck %s --match-full-lines --check-prefixes=CHECK-23
+; CHECK-23: function(loop-mssa(licm,loop-rotate,loop-deletion,lnicm,loop-rotate))
More information about the llvm-commits
mailing list