[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
This commit is contained in:
Markus Lavin 2021-12-01 07:39:40 +01:00
parent 69a8a7cf2d
commit ce22b7f17b
2 changed files with 15 additions and 3 deletions

View File

@ -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 << ",";
}

View File

@ -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))