diff --git a/llvm/include/llvm/Transforms/IPO/Inliner.h b/llvm/include/llvm/Transforms/IPO/Inliner.h --- a/llvm/include/llvm/Transforms/IPO/Inliner.h +++ b/llvm/include/llvm/Transforms/IPO/Inliner.h @@ -138,6 +138,9 @@ MPM.addPass(std::move(Pass)); } + void printPipeline(raw_ostream &OS, + function_ref MapClassName2PassName); + private: const InlineParams Params; const InliningAdvisorMode Mode; diff --git a/llvm/lib/Transforms/IPO/Inliner.cpp b/llvm/lib/Transforms/IPO/Inliner.cpp --- a/llvm/lib/Transforms/IPO/Inliner.cpp +++ b/llvm/lib/Transforms/IPO/Inliner.cpp @@ -1061,3 +1061,21 @@ if (OnlyMandatory) OS << ""; } + +void ModuleInlinerWrapperPass::printPipeline( + raw_ostream &OS, function_ref MapClassName2PassName) { + // Print some info about passes added to the wrapper. This is however + // incomplete as InlineAdvisorAnalysis part isn't included (which also depends + // on Params and Mode). + if (!MPM.isEmpty()) { + MPM.printPipeline(OS, MapClassName2PassName); + OS << ","; + } + OS << "cgscc("; + if (MaxDevirtIterations != 0) + OS << "devirt<" << MaxDevirtIterations << ">("; + PM.printPipeline(OS, MapClassName2PassName); + if (MaxDevirtIterations != 0) + OS << ")"; + OS << ")"; +} diff --git a/llvm/test/Other/new-pm-print-pipeline.ll b/llvm/test/Other/new-pm-print-pipeline.ll --- a/llvm/test/Other/new-pm-print-pipeline.ll +++ b/llvm/test/Other/new-pm-print-pipeline.ll @@ -60,3 +60,9 @@ ; RUN: opt -disable-output -disable-verify -print-pipeline-passes -passes='function(loop-vectorize,loop-vectorize)' < %s | FileCheck %s --match-full-lines --check-prefixes=CHECK-19 ; CHECK-19: function(loop-vectorize,loop-vectorize) + +; RUN: opt -disable-output -disable-verify -print-pipeline-passes -passes='inliner-wrapper,inliner-wrapper-no-mandatory-first' < %s | FileCheck %s --match-full-lines --check-prefixes=CHECK-20 +; CHECK-20: cgscc(inline,inline),cgscc(inline) + +; RUN: opt -disable-output -disable-verify -print-pipeline-passes -passes='scc-oz-module-inliner' < %s | FileCheck %s --match-full-lines --check-prefixes=CHECK-21 +; CHECK-21: require,function(invalidate),require,cgscc(devirt<4>(inline,inline,{{.*}},instcombine{{.*}}))