diff --git a/llvm/lib/Transforms/Scalar/LoopPassManager.cpp b/llvm/lib/Transforms/Scalar/LoopPassManager.cpp index 3df4cfe8e4c1..6c783848432b 100644 --- a/llvm/lib/Transforms/Scalar/LoopPassManager.cpp +++ b/llvm/lib/Transforms/Scalar/LoopPassManager.cpp @@ -49,9 +49,17 @@ void PassManager::printPipeline(raw_ostream &OS, function_ref 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 da06e9308051..ac0a1a06b7e7 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(no-op-function)),function(no-op-function)' < %s | FileCheck %s --match-full-lines --check-prefixes=CHECK-22 ; CHECK-22: cgscc(function(no-op-function)),function(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))