[llvm] 645af79 - Revert "[NPM] Added opt option -print-pipeline-passes."

Markus Lavin via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 1 23:23:03 PDT 2021


Author: Markus Lavin
Date: 2021-09-02T08:22:17+02:00
New Revision: 645af79e8e5f23382934b8d65f8af94438893f9f

URL: https://github.com/llvm/llvm-project/commit/645af79e8e5f23382934b8d65f8af94438893f9f
DIFF: https://github.com/llvm/llvm-project/commit/645af79e8e5f23382934b8d65f8af94438893f9f.diff

LOG: Revert "[NPM] Added opt option -print-pipeline-passes."

This reverts commit c71869ed4c24b3d4d13e2f83ee2c0104013ca129.

Added: 
    

Modified: 
    llvm/include/llvm/IR/PassManager.h
    llvm/include/llvm/IR/PassManagerInternal.h
    llvm/include/llvm/Transforms/Scalar/LoopPassManager.h
    llvm/include/llvm/Transforms/Scalar/SimplifyCFG.h
    llvm/lib/IR/PassManager.cpp
    llvm/lib/Passes/PassBuilder.cpp
    llvm/lib/Transforms/Scalar/LoopPassManager.cpp
    llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
    llvm/tools/opt/NewPMDriver.cpp

Removed: 
    llvm/test/Other/new-pm-print-pipeline.ll


################################################################################
diff  --git a/llvm/include/llvm/IR/PassManager.h b/llvm/include/llvm/IR/PassManager.h
index 8583cabd44913..8e592bfb0c785 100644
--- a/llvm/include/llvm/IR/PassManager.h
+++ b/llvm/include/llvm/IR/PassManager.h
@@ -381,13 +381,6 @@ template <typename DerivedT> struct PassInfoMixin {
       Name = Name.drop_front(strlen("llvm::"));
     return Name;
   }
-
-  void printPipeline(raw_ostream &OS,
-                     function_ref<StringRef(StringRef)> MapClassName2PassName) {
-    auto ClassName = name();
-    auto PassName = MapClassName2PassName(ClassName);
-    OS << PassName;
-  }
 };
 
 /// A CRTP mix-in that provides informational APIs needed for analysis passes.
@@ -487,16 +480,6 @@ class PassManager : public PassInfoMixin<
     return *this;
   }
 
-  void printPipeline(raw_ostream &OS,
-                     function_ref<StringRef(StringRef)> MapClassName2PassName) {
-    for (unsigned Idx = 0, Size = Passes.size(); Idx != Size; ++Idx) {
-      auto *P = Passes[Idx].get();
-      P->printPipeline(OS, MapClassName2PassName);
-      if (Idx + 1 < Size)
-        OS << ",";
-    }
-  }
-
   /// Run all of the passes in this manager over the given unit of IR.
   /// ExtraArgs are passed to each pass.
   PreservedAnalyses run(IRUnitT &IR, AnalysisManagerT &AM,
@@ -1212,8 +1195,6 @@ class ModuleToFunctionPassAdaptor
 
   /// Runs the function pass across every function in the module.
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
-  void printPipeline(raw_ostream &OS,
-                     function_ref<StringRef(StringRef)> MapClassName2PassName);
 
   static bool isRequired() { return true; }
 
@@ -1262,12 +1243,6 @@ struct RequireAnalysisPass
 
     return PreservedAnalyses::all();
   }
-  void printPipeline(raw_ostream &OS,
-                     function_ref<StringRef(StringRef)> MapClassName2PassName) {
-    auto ClassName = AnalysisT::name();
-    auto PassName = MapClassName2PassName(ClassName);
-    OS << "require<" << PassName << ">";
-  }
   static bool isRequired() { return true; }
 };
 
@@ -1288,12 +1263,6 @@ struct InvalidateAnalysisPass
     PA.abandon<AnalysisT>();
     return PA;
   }
-  void printPipeline(raw_ostream &OS,
-                     function_ref<StringRef(StringRef)> MapClassName2PassName) {
-    auto ClassName = AnalysisT::name();
-    auto PassName = MapClassName2PassName(ClassName);
-    OS << "invalidate<" << PassName << ">";
-  }
 };
 
 /// A utility pass that does nothing, but preserves no analyses.
@@ -1343,13 +1312,6 @@ class RepeatedPass : public PassInfoMixin<RepeatedPass<PassT>> {
     return PA;
   }
 
-  void printPipeline(raw_ostream &OS,
-                     function_ref<StringRef(StringRef)> MapClassName2PassName) {
-    OS << "repeat<" << Count << ">(";
-    P.printPipeline(OS, MapClassName2PassName);
-    OS << ")";
-  }
-
 private:
   int Count;
   PassT P;

diff  --git a/llvm/include/llvm/IR/PassManagerInternal.h b/llvm/include/llvm/IR/PassManagerInternal.h
index 29b55a8172e63..8f42e69f30631 100644
--- a/llvm/include/llvm/IR/PassManagerInternal.h
+++ b/llvm/include/llvm/IR/PassManagerInternal.h
@@ -46,9 +46,6 @@ struct PassConcept {
   virtual PreservedAnalyses run(IRUnitT &IR, AnalysisManagerT &AM,
                                 ExtraArgTs... ExtraArgs) = 0;
 
-  virtual void
-  printPipeline(raw_ostream &OS,
-                function_ref<StringRef(StringRef)> MapClassName2PassName) = 0;
   /// Polymorphic method to access the name of a pass.
   virtual StringRef name() const = 0;
 
@@ -88,12 +85,6 @@ struct PassModel : PassConcept<IRUnitT, AnalysisManagerT, ExtraArgTs...> {
     return Pass.run(IR, AM, ExtraArgs...);
   }
 
-  void printPipeline(
-      raw_ostream &OS,
-      function_ref<StringRef(StringRef)> MapClassName2PassName) override {
-    Pass.printPipeline(OS, MapClassName2PassName);
-  }
-
   StringRef name() const override { return PassT::name(); }
 
   template <typename T>

diff  --git a/llvm/include/llvm/Transforms/Scalar/LoopPassManager.h b/llvm/include/llvm/Transforms/Scalar/LoopPassManager.h
index 9bebe64d42f84..020cfb9a6c851 100644
--- a/llvm/include/llvm/Transforms/Scalar/LoopPassManager.h
+++ b/llvm/include/llvm/Transforms/Scalar/LoopPassManager.h
@@ -94,8 +94,6 @@ class PassManager<Loop, LoopAnalysisManager, LoopStandardAnalysisResults &,
   PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
                         LoopStandardAnalysisResults &AR, LPMUpdater &U);
 
-  void printPipeline(raw_ostream &OS,
-                     function_ref<StringRef(StringRef)> MapClassName2PassName);
   /// Add either a loop pass or a loop-nest pass to the pass manager. Append \p
   /// Pass to the list of loop passes if it has a dedicated \fn run() method for
   /// loops and to the list of loop-nest passes if the \fn run() method is for
@@ -426,8 +424,6 @@ class FunctionToLoopPassAdaptor
 
   /// Runs the loop passes across every loop in the function.
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
-  void printPipeline(raw_ostream &OS,
-                     function_ref<StringRef(StringRef)> MapClassName2PassName);
 
   static bool isRequired() { return true; }
 

diff  --git a/llvm/include/llvm/Transforms/Scalar/SimplifyCFG.h b/llvm/include/llvm/Transforms/Scalar/SimplifyCFG.h
index 67db5031a4438..7c5393851ae68 100644
--- a/llvm/include/llvm/Transforms/Scalar/SimplifyCFG.h
+++ b/llvm/include/llvm/Transforms/Scalar/SimplifyCFG.h
@@ -41,9 +41,6 @@ class SimplifyCFGPass : public PassInfoMixin<SimplifyCFGPass> {
 
   /// Run the pass over the function.
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
-
-  void printPipeline(raw_ostream &OS,
-                     function_ref<StringRef(StringRef)> MapClassName2PassName);
 };
 
 }

diff  --git a/llvm/lib/IR/PassManager.cpp b/llvm/lib/IR/PassManager.cpp
index bb8885a5e152d..4cf7ab2a602b2 100644
--- a/llvm/lib/IR/PassManager.cpp
+++ b/llvm/lib/IR/PassManager.cpp
@@ -91,13 +91,6 @@ bool FunctionAnalysisManagerModuleProxy::Result::invalidate(
 }
 } // namespace llvm
 
-void ModuleToFunctionPassAdaptor::printPipeline(
-    raw_ostream &OS, function_ref<StringRef(StringRef)> MapClassName2PassName) {
-  OS << "function(";
-  Pass->printPipeline(OS, MapClassName2PassName);
-  OS << ")";
-}
-
 PreservedAnalyses ModuleToFunctionPassAdaptor::run(Module &M,
                                                    ModuleAnalysisManager &AM) {
   FunctionAnalysisManager &FAM =

diff  --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index c7fd2338de47d..e118633c7ea61 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -291,11 +291,6 @@ PipelineTuningOptions::PipelineTuningOptions() {
 }
 
 namespace llvm {
-cl::opt<bool> PrintPipelinePasses(
-    "print-pipeline-passes",
-    cl::desc("Print a '-passes' compatible string describing the pipeline "
-             "(best-effort only)."));
-
 extern cl::opt<unsigned> MaxDevirtIterations;
 extern cl::opt<bool> EnableConstraintElimination;
 extern cl::opt<bool> EnableFunctionSpecialization;
@@ -444,8 +439,7 @@ AnalysisKey NoOpLoopAnalysis::Key;
 /// it. This should be updated if new pass instrumentation wants to use the map.
 /// We currently only use this for --print-before/after.
 bool shouldPopulateClassToPassNames() {
-  return PrintPipelinePasses || !printBeforePasses().empty() ||
-         !printAfterPasses().empty();
+  return !printBeforePasses().empty() || !printAfterPasses().empty();
 }
 
 } // namespace

diff  --git a/llvm/lib/Transforms/Scalar/LoopPassManager.cpp b/llvm/lib/Transforms/Scalar/LoopPassManager.cpp
index 1794d05373d73..9f61aa0ed918c 100644
--- a/llvm/lib/Transforms/Scalar/LoopPassManager.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopPassManager.cpp
@@ -44,18 +44,6 @@ PassManager<Loop, LoopAnalysisManager, LoopStandardAnalysisResults &,
   return PA;
 }
 
-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);
-    if (Idx + 1 < Size)
-      OS << ",";
-  }
-}
-
 // Run both loop passes and loop-nest passes on top-level loop \p L.
 PreservedAnalyses
 LoopPassManager::runWithLoopNestPasses(Loop &L, LoopAnalysisManager &AM,
@@ -184,12 +172,6 @@ LoopPassManager::runWithoutLoopNestPasses(Loop &L, LoopAnalysisManager &AM,
 }
 } // namespace llvm
 
-void FunctionToLoopPassAdaptor::printPipeline(
-    raw_ostream &OS, function_ref<StringRef(StringRef)> MapClassName2PassName) {
-  OS << (UseMemorySSA ? "loop-mssa(" : "loop(");
-  Pass->printPipeline(OS, MapClassName2PassName);
-  OS << ")";
-}
 PreservedAnalyses FunctionToLoopPassAdaptor::run(Function &F,
                                                  FunctionAnalysisManager &AM) {
   // Before we even compute any loop analyses, first run a miniature function

diff  --git a/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp b/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
index c499d51a39146..09d59b0e884ae 100644
--- a/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
+++ b/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
@@ -319,21 +319,6 @@ SimplifyCFGPass::SimplifyCFGPass(const SimplifyCFGOptions &Opts)
   applyCommandLineOverridesToOptions(Options);
 }
 
-void SimplifyCFGPass::printPipeline(
-    raw_ostream &OS, function_ref<StringRef(StringRef)> MapClassName2PassName) {
-  static_cast<PassInfoMixin<SimplifyCFGPass> *>(this)->printPipeline(
-      OS, MapClassName2PassName);
-  OS << "<";
-  OS << "bonus-inst-threshold=" << Options.BonusInstThreshold << ";";
-  OS << (Options.ForwardSwitchCondToPhi ? "" : "no-") << "forward-switch-cond;";
-  OS << (Options.ConvertSwitchToLookupTable ? "" : "no-")
-     << "switch-to-lookup;";
-  OS << (Options.NeedCanonicalLoop ? "" : "no-") << "keep-loops;";
-  OS << (Options.HoistCommonInsts ? "" : "no-") << "hoist-common-insts;";
-  OS << (Options.SinkCommonInsts ? "" : "no-") << "sink-common-insts";
-  OS << ">";
-}
-
 PreservedAnalyses SimplifyCFGPass::run(Function &F,
                                        FunctionAnalysisManager &AM) {
   auto &TTI = AM.getResult<TargetIRAnalysis>(F);

diff  --git a/llvm/test/Other/new-pm-print-pipeline.ll b/llvm/test/Other/new-pm-print-pipeline.ll
deleted file mode 100644
index c17ced28b4e47..0000000000000
--- a/llvm/test/Other/new-pm-print-pipeline.ll
+++ /dev/null
@@ -1,17 +0,0 @@
-;; Test that the -print-pipeline-passes option correctly prints some explicitly specified pipelines.
-
-; RUN: opt -disable-output -disable-verify -print-pipeline-passes -passes='function(adce),function(simplifycfg<bonus-inst-threshold=123;no-forward-switch-cond;switch-to-lookup;keep-loops;no-hoist-common-insts;sink-common-insts>)' < %s | FileCheck %s --match-full-lines --check-prefixes=CHECK-0
-; CHECK-0: function(adce),function(simplifycfg<bonus-inst-threshold=123;no-forward-switch-cond;switch-to-lookup;keep-loops;no-hoist-common-insts;sink-common-insts>)
-
-; RUN: opt -disable-output -disable-verify -print-pipeline-passes -passes='module(rpo-function-attrs,require<globals-aa>,function(float2int,lower-constant-intrinsics,loop(loop-rotate)),invalidate<globals-aa>)' < %s | FileCheck %s --match-full-lines --check-prefixes=CHECK-1
-; CHECK-1: rpo-function-attrs,require<globals-aa>,function(float2int,lower-constant-intrinsics,loop(loop-rotate)),invalidate<globals-aa>
-
-; RUN: opt -disable-output -disable-verify -print-pipeline-passes -passes='repeat<5>(function(mem2reg)),invalidate<all>' < %s | FileCheck %s --match-full-lines --check-prefixes=CHECK-2
-; CHECK-2: repeat<5>(function(mem2reg)),invalidate<all>
-
-;; Test that we get ClassName printed when there is no ClassName to pass-name mapping (as is the case for the BitcodeWriterPass).
-; RUN: opt -o /dev/null -disable-verify -print-pipeline-passes -passes='function(mem2reg)' < %s | FileCheck %s --match-full-lines --check-prefixes=CHECK-3
-; CHECK-3: function(mem2reg),BitcodeWriterPass
-
-; RUN: opt -disable-output -disable-verify -print-pipeline-passes -passes='function(loop-mssa(indvars))' < %s | FileCheck %s --match-full-lines --check-prefixes=CHECK-4
-; CHECK-4: function(loop-mssa(indvars))

diff  --git a/llvm/tools/opt/NewPMDriver.cpp b/llvm/tools/opt/NewPMDriver.cpp
index 794c01f31c11f..e1989958b9f29 100644
--- a/llvm/tools/opt/NewPMDriver.cpp
+++ b/llvm/tools/opt/NewPMDriver.cpp
@@ -137,7 +137,6 @@ extern cl::opt<std::string> ProfileFile;
 extern cl::opt<CSPGOKind> CSPGOKindFlag;
 extern cl::opt<std::string> CSProfileGenFile;
 extern cl::opt<bool> DisableBasicAA;
-extern cl::opt<bool> PrintPipelinePasses;
 } // namespace llvm
 
 static cl::opt<std::string>
@@ -474,17 +473,6 @@ bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM,
   // Before executing passes, print the final values of the LLVM options.
   cl::PrintOptionValues();
 
-  // Print a textual, '-passes=' compatible, representation of pipeline if
-  // requested.
-  if (PrintPipelinePasses) {
-    MPM.printPipeline(outs(), [&PIC](StringRef ClassName) {
-      auto PassName = PIC.getPassNameForClassName(ClassName);
-      return PassName.empty() ? ClassName : PassName;
-    });
-    outs() << "\n";
-    return true;
-  }
-
   // Now that we have all of the passes ready, run them.
   MPM.run(M, MAM);
 


        


More information about the llvm-commits mailing list