[llvm] eaab6ab - [llc] Respect --print-pipeline-passes when using -passes (#80940)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 7 09:16:51 PST 2024
Author: Arthur Eubanks
Date: 2024-02-07T09:16:47-08:00
New Revision: eaab6abd79bf1a377bf034e1cf652a93d10b45fb
URL: https://github.com/llvm/llvm-project/commit/eaab6abd79bf1a377bf034e1cf652a93d10b45fb
DIFF: https://github.com/llvm/llvm-project/commit/eaab6abd79bf1a377bf034e1cf652a93d10b45fb.diff
LOG: [llc] Respect --print-pipeline-passes when using -passes (#80940)
Added:
llvm/test/tools/llc/new-pm/pipeline.mir
Modified:
llvm/tools/llc/NewPMDriver.cpp
Removed:
################################################################################
diff --git a/llvm/test/tools/llc/new-pm/pipeline.mir b/llvm/test/tools/llc/new-pm/pipeline.mir
new file mode 100644
index 00000000000000..c7dda4b6d13560
--- /dev/null
+++ b/llvm/test/tools/llc/new-pm/pipeline.mir
@@ -0,0 +1,11 @@
+# RUN: llc -mtriple=x86_64-pc-linux-gnu -x mir -passes=no-op-machine-function --print-pipeline-passes -filetype=null < %s | FileCheck %s --match-full-lines
+
+# CHECK: IR pipeline: PrintMIRPreparePass
+# CHECK: MIR pipeline: no-op-machine-function,print,FreeMachineFunctionPass
+
+---
+name: f
+body: |
+ bb.0:
+ RET 0
+...
diff --git a/llvm/tools/llc/NewPMDriver.cpp b/llvm/tools/llc/NewPMDriver.cpp
index e41f2d013855d6..c3288ef9d0808b 100644
--- a/llvm/tools/llc/NewPMDriver.cpp
+++ b/llvm/tools/llc/NewPMDriver.cpp
@@ -190,9 +190,6 @@ int llvm::compileModuleWithNewPM(
auto &MMI = MFAM.getResult<MachineModuleAnalysis>(*M).getMMI();
if (MIR->parseMachineFunctions(*M, MMI))
return 1;
-
- RunPasses(BOS.get(), Out.get(), M.get(), Context, Buffer, &MPM, &MAM, MFPM,
- MFAM);
} else {
ExitOnErr(LLVMTM.buildCodeGenPipeline(MPM, MFPM, MFAM, *OS,
DwoOut ? &DwoOut->os() : nullptr,
@@ -200,36 +197,35 @@ int llvm::compileModuleWithNewPM(
auto StartStopInfo = TargetPassConfig::getStartStopInfo(PIC);
assert(StartStopInfo && "Expect StartStopInfo!");
- // Add IR or MIR printing pass according the pass type.
if (auto StopPassName = StartStopInfo->StopPass; !StopPassName.empty()) {
MFPM.addPass(PrintMIRPass(*OS));
MFPM.addPass(FreeMachineFunctionPass());
}
+ }
- if (PrintPipelinePasses) {
- std::string IRPipeline;
- raw_string_ostream IRSOS(IRPipeline);
- MPM.printPipeline(IRSOS, [&PIC](StringRef ClassName) {
- auto PassName = PIC.getPassNameForClassName(ClassName);
- return PassName.empty() ? ClassName : PassName;
- });
- outs() << "IR pipeline: " << IRPipeline << '\n';
-
- std::string MIRPipeline;
- raw_string_ostream MIRSOS(MIRPipeline);
- MFPM.printPipeline(MIRSOS, [&PIC](StringRef ClassName) {
- auto PassName = PIC.getPassNameForClassName(ClassName);
- return PassName.empty() ? ClassName : PassName;
- });
- outs() << "MIR pipeline: " << MIRPipeline << '\n';
- return 0;
- }
-
- RunPasses(BOS.get(), Out.get(), M.get(), Context, Buffer, &MPM, &MAM, MFPM,
- MFAM);
+ if (PrintPipelinePasses) {
+ std::string IRPipeline;
+ raw_string_ostream IRSOS(IRPipeline);
+ MPM.printPipeline(IRSOS, [&PIC](StringRef ClassName) {
+ auto PassName = PIC.getPassNameForClassName(ClassName);
+ return PassName.empty() ? ClassName : PassName;
+ });
+ outs() << "IR pipeline: " << IRPipeline << '\n';
+
+ std::string MIRPipeline;
+ raw_string_ostream MIRSOS(MIRPipeline);
+ MFPM.printPipeline(MIRSOS, [&PIC](StringRef ClassName) {
+ auto PassName = PIC.getPassNameForClassName(ClassName);
+ return PassName.empty() ? ClassName : PassName;
+ });
+ outs() << "MIR pipeline: " << MIRPipeline << '\n';
+ return 0;
}
+ RunPasses(BOS.get(), Out.get(), M.get(), Context, Buffer, &MPM, &MAM, MFPM,
+ MFAM);
+
// Declare success.
Out->keep();
if (DwoOut)
More information about the llvm-commits
mailing list