forked from OSchip/llvm-project
Revert "Load pass plugins during option processing, so that plugin options are registered and live."
This reverts commit 5e8700ce8b
.
This commit is contained in:
parent
7262eacd41
commit
ed4c03afac
|
@ -1,7 +1,6 @@
|
|||
; REQUIRES: x86-registered-target
|
||||
; RUN: opt %s %loadbye -goodbye -wave-goodbye -disable-output -enable-new-pm=0 2>&1 | FileCheck %s
|
||||
; RUN: opt %s %loadnewpmbye %loadbye -passes="goodbye" -wave-goodbye -disable-output 2>&1 | FileCheck %s
|
||||
; RUN: opt %s %loadnewpmbye -passes="goodbye" -wave-goodbye -disable-output 2>&1 | FileCheck %s
|
||||
; RUN: opt -module-summary %s -o %t.o
|
||||
; RUN: llvm-lto2 run %t.o %loadbye -wave-goodbye -use-new-pm=0 -o %t -r %t.o,somefunk,plx -r %t.o,junk,plx 2>&1 | FileCheck %s
|
||||
; RUN: llvm-lto2 run %t.o %loadbye %loadnewpmbye -wave-goodbye -use-new-pm -o %t -r %t.o,somefunk,plx -r %t.o,junk,plx 2>&1 | FileCheck %s
|
||||
|
@ -18,6 +17,3 @@ define i32* @somefunk() {
|
|||
ret i32* @junk
|
||||
}
|
||||
|
||||
; Specifying a new PM pass plugin with the old PM is an error.
|
||||
; RUN: ! opt %s %loadnewpmbye -goodbye -wave-goodbye -disable-output -enable-new-pm=0 2>&1 | FileCheck %s --check-prefix=ERROR
|
||||
; ERROR: load-pass-plugin specified with legacy PM.
|
||||
|
|
|
@ -66,6 +66,10 @@ static cl::opt<DebugLogging> DebugPM(
|
|||
DebugLogging::Verbose, "verbose",
|
||||
"Print extra information about adaptors and pass managers")));
|
||||
|
||||
static cl::list<std::string>
|
||||
PassPlugins("load-pass-plugin",
|
||||
cl::desc("Load passes from plugin library"));
|
||||
|
||||
// This flag specifies a textual description of the alias analysis pipeline to
|
||||
// use when querying for aliasing information. It only works in concert with
|
||||
// the "passes" flag above.
|
||||
|
@ -265,7 +269,6 @@ bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM,
|
|||
ToolOutputFile *ThinLTOLinkOut,
|
||||
ToolOutputFile *OptRemarkFile,
|
||||
StringRef PassPipeline, ArrayRef<StringRef> Passes,
|
||||
ArrayRef<PassPlugin> PassPlugins,
|
||||
OutputKind OK, VerifierKind VK,
|
||||
bool ShouldPreserveAssemblyUseListOrder,
|
||||
bool ShouldPreserveBitcodeUseListOrder,
|
||||
|
@ -338,9 +341,17 @@ bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM,
|
|||
PassBuilder PB(TM, PTO, P, &PIC);
|
||||
registerEPCallbacks(PB);
|
||||
|
||||
// For any loaded plugins, let them register pass builder callbacks.
|
||||
for (auto &PassPlugin : PassPlugins)
|
||||
PassPlugin.registerPassBuilderCallbacks(PB);
|
||||
// Load requested pass plugins and let them register pass builder callbacks
|
||||
for (auto &PluginFN : PassPlugins) {
|
||||
auto PassPlugin = PassPlugin::Load(PluginFN);
|
||||
if (!PassPlugin) {
|
||||
errs() << "Failed to load passes from '" << PluginFN
|
||||
<< "'. Request ignored.\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
PassPlugin->registerPassBuilderCallbacks(PB);
|
||||
}
|
||||
|
||||
PB.registerPipelineParsingCallback(
|
||||
[](StringRef Name, ModulePassManager &MPM,
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
namespace llvm {
|
||||
class StringRef;
|
||||
class Module;
|
||||
class PassPlugin;
|
||||
class TargetMachine;
|
||||
class ToolOutputFile;
|
||||
class TargetLibraryInfoImpl;
|
||||
|
@ -70,8 +69,7 @@ bool runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM,
|
|||
TargetLibraryInfoImpl *TLII, ToolOutputFile *Out,
|
||||
ToolOutputFile *ThinLinkOut, ToolOutputFile *OptRemarkFile,
|
||||
StringRef PassPipeline, ArrayRef<StringRef> PassInfos,
|
||||
ArrayRef<PassPlugin> PassPlugins, opt_tool::OutputKind OK,
|
||||
opt_tool::VerifierKind VK,
|
||||
opt_tool::OutputKind OK, opt_tool::VerifierKind VK,
|
||||
bool ShouldPreserveAssemblyUseListOrder,
|
||||
bool ShouldPreserveBitcodeUseListOrder,
|
||||
bool EmitSummaryIndex, bool EmitModuleHash,
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#include "llvm/LinkAllPasses.h"
|
||||
#include "llvm/MC/SubtargetFeature.h"
|
||||
#include "llvm/MC/TargetRegistry.h"
|
||||
#include "llvm/Passes/PassPlugin.h"
|
||||
#include "llvm/Remarks/HotnessThresholdParser.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/FileSystem.h"
|
||||
|
@ -301,10 +300,6 @@ static cl::opt<std::string> RemarksFormat(
|
|||
cl::desc("The format used for serializing remarks (default: YAML)"),
|
||||
cl::value_desc("format"), cl::init("yaml"));
|
||||
|
||||
static cl::list<std::string>
|
||||
PassPlugins("load-pass-plugin",
|
||||
cl::desc("Load passes from plugin library"));
|
||||
|
||||
namespace llvm {
|
||||
cl::opt<PGOKind>
|
||||
PGOKindFlag("pgo-kind", cl::init(NoPGO), cl::Hidden,
|
||||
|
@ -586,17 +581,6 @@ int main(int argc, char **argv) {
|
|||
initializeExampleIRTransforms(Registry);
|
||||
#endif
|
||||
|
||||
SmallVector<PassPlugin, 1> PluginList;
|
||||
PassPlugins.setCallback([&](const std::string &PluginPath) {
|
||||
auto Plugin = PassPlugin::Load(PluginPath);
|
||||
if (!Plugin) {
|
||||
errs() << "Failed to load passes from '" << PluginPath
|
||||
<< "'. Request ignored.\n";
|
||||
return;
|
||||
}
|
||||
PluginList.emplace_back(Plugin.get());
|
||||
});
|
||||
|
||||
cl::ParseCommandLineOptions(argc, argv,
|
||||
"llvm .bc -> .bc modular optimizer and analysis printer\n");
|
||||
|
||||
|
@ -607,19 +591,6 @@ int main(int argc, char **argv) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
// If `-passes=` is specified, use NPM.
|
||||
// If `-enable-new-pm` is specified and there are no codegen passes, use NPM.
|
||||
// e.g. `-enable-new-pm -sroa` will use NPM.
|
||||
// but `-enable-new-pm -codegenprepare` will still revert to legacy PM.
|
||||
const bool UseNPM = (EnableNewPassManager && !shouldForceLegacyPM()) ||
|
||||
PassPipeline.getNumOccurrences() > 0;
|
||||
|
||||
if (!UseNPM && PluginList.size()) {
|
||||
errs() << argv[0] << ": " << PassPlugins.ArgStr
|
||||
<< " specified with legacy PM.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
// FIXME: once the legacy PM code is deleted, move runPassPipeline() here and
|
||||
// construct the PassBuilder before parsing IR so we can reuse the same
|
||||
// PassBuilder for print passes.
|
||||
|
@ -781,7 +752,12 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
}
|
||||
|
||||
if (UseNPM) {
|
||||
// If `-passes=` is specified, use NPM.
|
||||
// If `-enable-new-pm` is specified and there are no codegen passes, use NPM.
|
||||
// e.g. `-enable-new-pm -sroa` will use NPM.
|
||||
// but `-enable-new-pm -codegenprepare` will still revert to legacy PM.
|
||||
if ((EnableNewPassManager && !shouldForceLegacyPM()) ||
|
||||
PassPipeline.getNumOccurrences() > 0) {
|
||||
if (AnalyzeOnly) {
|
||||
errs() << "Cannot specify -analyze under new pass manager, either "
|
||||
"specify '-enable-new-pm=0', or use the corresponding new pass "
|
||||
|
@ -845,7 +821,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,
|
||||
Passes, OK, VK, PreserveAssemblyUseListOrder,
|
||||
PreserveBitcodeUseListOrder, EmitSummaryIndex,
|
||||
EmitModuleHash, EnableDebugify)
|
||||
? 0
|
||||
|
|
Loading…
Reference in New Issue