[llvm] 9c980f7 - [opt] Clean up code related to parsing legacy passes for new PM driver. NFC
Bjorn Pettersson via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 12 08:48:01 PST 2022
Author: Bjorn Pettersson
Date: 2022-12-12T17:47:25+01:00
New Revision: 9c980f767cb965a9997eba42fdc4d2dc15015f0a
URL: https://github.com/llvm/llvm-project/commit/9c980f767cb965a9997eba42fdc4d2dc15015f0a
DIFF: https://github.com/llvm/llvm-project/commit/9c980f767cb965a9997eba42fdc4d2dc15015f0a.diff
LOG: [opt] Clean up code related to parsing legacy passes for new PM driver. NFC
Just some minor cleanups given that `opt -passname` syntax is dead
for the new pass manager driver.
Added:
Modified:
llvm/tools/opt/NewPMDriver.cpp
llvm/tools/opt/NewPMDriver.h
llvm/tools/opt/opt.cpp
Removed:
################################################################################
diff --git a/llvm/tools/opt/NewPMDriver.cpp b/llvm/tools/opt/NewPMDriver.cpp
index 6b66f64b1dc4c..71ebb686a3066 100644
--- a/llvm/tools/opt/NewPMDriver.cpp
+++ b/llvm/tools/opt/NewPMDriver.cpp
@@ -324,7 +324,7 @@ bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM,
TargetLibraryInfoImpl *TLII, ToolOutputFile *Out,
ToolOutputFile *ThinLTOLinkOut,
ToolOutputFile *OptRemarkFile,
- StringRef PassPipeline, ArrayRef<StringRef> Passes,
+ StringRef PassPipeline,
ArrayRef<PassPlugin> PassPlugins,
OutputKind OK, VerifierKind VK,
bool ShouldPreserveAssemblyUseListOrder,
@@ -448,23 +448,11 @@ bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM,
// Add passes according to the -passes options.
if (!PassPipeline.empty()) {
- assert(Passes.empty() &&
- "PassPipeline and Passes should not both contain passes");
if (auto Err = PB.parsePassPipeline(MPM, PassPipeline)) {
errs() << Arg0 << ": " << toString(std::move(Err)) << "\n";
return false;
}
}
- // Add passes specified using the legacy PM syntax (i.e. not using
- // -passes). This should be removed later when such support has been
- // deprecated, i.e. when all lit tests running opt (and not using
- // -enable-new-pm=0) have been updated to use -passes.
- for (auto PassName : Passes) {
- if (auto Err = PB.parsePassPipeline(MPM, PassName)) {
- errs() << Arg0 << ": " << toString(std::move(Err)) << "\n";
- return false;
- }
- }
if (VK > VK_NoVerifier)
MPM.addPass(VerifierPass());
diff --git a/llvm/tools/opt/NewPMDriver.h b/llvm/tools/opt/NewPMDriver.h
index 543f91c383f22..e01179ec611a0 100644
--- a/llvm/tools/opt/NewPMDriver.h
+++ b/llvm/tools/opt/NewPMDriver.h
@@ -71,7 +71,7 @@ void printPasses(raw_ostream &OS);
bool runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM,
TargetLibraryInfoImpl *TLII, ToolOutputFile *Out,
ToolOutputFile *ThinLinkOut, ToolOutputFile *OptRemarkFile,
- StringRef PassPipeline, ArrayRef<StringRef> PassInfos,
+ StringRef PassPipeline,
ArrayRef<PassPlugin> PassPlugins, opt_tool::OutputKind OK,
opt_tool::VerifierKind VK,
bool ShouldPreserveAssemblyUseListOrder,
diff --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp
index 12545b3b5c3dc..f7f9fbff8c6fc 100644
--- a/llvm/tools/opt/opt.cpp
+++ b/llvm/tools/opt/opt.cpp
@@ -664,26 +664,19 @@ int main(int argc, char **argv) {
"-debug-pass-manager, or use the legacy PM (-enable-new-pm=0)\n";
return 1;
}
- if (PassPipeline.getNumOccurrences() > 0 && PassList.size() > 0) {
- errs()
- << "Cannot specify passes via both -foo-pass and --passes=foo-pass\n";
- return 1;
- }
auto NumOLevel = OptLevelO0 + OptLevelO1 + OptLevelO2 + OptLevelO3 +
OptLevelOs + OptLevelOz;
if (NumOLevel > 1) {
errs() << "Cannot specify multiple -O#\n";
return 1;
}
- if (NumOLevel > 0 &&
- (PassPipeline.getNumOccurrences() > 0 || PassList.size() > 0)) {
+ if (NumOLevel > 0 && (PassPipeline.getNumOccurrences() > 0)) {
errs() << "Cannot specify -O# and --passes=/--foo-pass, use "
"-passes='default<O#>,other-pass'\n";
return 1;
}
std::string Pipeline = PassPipeline;
- SmallVector<StringRef, 4> Passes;
if (OptLevelO0)
Pipeline = "default<O0>";
if (OptLevelO1)
@@ -696,8 +689,6 @@ int main(int argc, char **argv) {
Pipeline = "default<Os>";
if (OptLevelOz)
Pipeline = "default<Oz>";
- for (const auto &P : PassList)
- Passes.push_back(P->getPassArgument());
OutputKind OK = OK_NoOutput;
if (!NoOutput)
OK = OutputAssembly
@@ -715,7 +706,7 @@ int main(int argc, char **argv) {
// layer.
return runPassPipeline(argv[0], *M, TM.get(), &TLII, Out.get(),
ThinLinkOut.get(), RemarksFile.get(), Pipeline,
- Passes, PluginList, OK, VK, PreserveAssemblyUseListOrder,
+ PluginList, OK, VK, PreserveAssemblyUseListOrder,
PreserveBitcodeUseListOrder, EmitSummaryIndex,
EmitModuleHash, EnableDebugify,
VerifyDebugInfoPreserve)
More information about the llvm-commits
mailing list