[PATCH] D148082: [opt] Cleanups related to legacy PM deprecation
Bjorn Pettersson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 12 02:07:41 PDT 2023
bjope created this revision.
Herald added a project: All.
bjope requested review of this revision.
Herald added a project: LLVM.
Remove dead code related to "FPasses". This was a leftover from
commit 7a5332b9b5584ce <https://reviews.llvm.org/rG7a5332b9b5584cec4517196ee86f8f3af2b78cd9>.
Do not mention -enable-new-pm in error messages. The option does
not exist any longer.
Remove the addPass helper. Only one use remained, so we can just
"inline" it manually to keep the code related to legacy PM a bit
less spread out.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D148082
Files:
llvm/tools/opt/opt.cpp
Index: llvm/tools/opt/opt.cpp
===================================================================
--- llvm/tools/opt/opt.cpp
+++ llvm/tools/opt/opt.cpp
@@ -274,15 +274,6 @@
PassPlugins("load-pass-plugin",
cl::desc("Load passes from plugin library"));
-static inline void addPass(legacy::PassManagerBase &PM, Pass *P) {
- // Add the pass to the pass manager...
- PM.add(P);
-
- // If we are verifying all of the intermediate steps, add the verifier...
- if (VerifyEach)
- PM.add(createVerifierPass());
-}
-
//===----------------------------------------------------------------------===//
// CodeGen-related helper functions.
//
@@ -663,9 +654,8 @@
if (UseNPM) {
if (legacy::debugPassSpecified()) {
- errs()
- << "-debug-pass does not work with the new PM, either use "
- "-debug-pass-manager, or use the legacy PM (-enable-new-pm=0)\n";
+ errs() << "-debug-pass does not work with the new PM, either use "
+ "-debug-pass-manager, or use the legacy PM\n";
return 1;
}
auto NumOLevel = OptLevelO0 + OptLevelO1 + OptLevelO2 + OptLevelO3 +
@@ -773,8 +763,6 @@
}
}
- std::unique_ptr<legacy::FunctionPassManager> FPasses;
-
if (TM) {
// FIXME: We should dyn_cast this when supported.
auto <M = static_cast<LLVMTargetMachine &>(*TM);
@@ -785,21 +773,18 @@
// Create a new optimization pass for each one specified on the command line
for (unsigned i = 0; i < PassList.size(); ++i) {
const PassInfo *PassInf = PassList[i];
- Pass *P = nullptr;
- if (PassInf->getNormalCtor())
- P = PassInf->getNormalCtor()();
- else
+ if (PassInf->getNormalCtor()) {
+ Pass *P = PassInf->getNormalCtor()();
+ if (P) {
+ // Add the pass to the pass manager.
+ Passes.add(P);
+ // If we are verifying all of the intermediate steps, add the verifier.
+ if (VerifyEach)
+ Passes.add(createVerifierPass());
+ }
+ } else
errs() << argv[0] << ": cannot create pass: "
<< PassInf->getPassName() << "\n";
- if (P)
- addPass(Passes, P);
- }
-
- if (FPasses) {
- FPasses->doInitialization();
- for (Function &F : *M)
- FPasses->run(F);
- FPasses->doFinalization();
}
// Check that the module is well formed on completion of optimization
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148082.512699.patch
Type: text/x-patch
Size: 2369 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230412/3b6bc1e2/attachment.bin>
More information about the llvm-commits
mailing list