forked from OSchip/llvm-project
[lld] Remove support for legacy pass manager
This removes options for performing LTO with the legacy pass manager in LLD. Options that explicitly enable the new pass manager are retained as no-ops. Differential Revision: https://reviews.llvm.org/D123219
This commit is contained in:
parent
5390606aa9
commit
b8f50abd04
|
@ -170,8 +170,6 @@ struct Configuration {
|
|||
// Used for /opt:lldltocachepolicy=policy
|
||||
llvm::CachePruningPolicy ltoCachePolicy;
|
||||
|
||||
// Used for /opt:[no]ltonewpassmanager
|
||||
bool ltoNewPassManager = false;
|
||||
// Used for /opt:[no]ltodebugpassmanager
|
||||
bool ltoDebugPassManager = false;
|
||||
|
||||
|
|
|
@ -1679,7 +1679,6 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
|
|||
if (args.hasArg(OPT_profile))
|
||||
icfLevel = ICFLevel::None;
|
||||
unsigned tailMerge = 1;
|
||||
bool ltoNewPM = true;
|
||||
bool ltoDebugPM = false;
|
||||
for (auto *arg : args.filtered(OPT_opt)) {
|
||||
std::string str = StringRef(arg->getValue()).lower();
|
||||
|
@ -1701,9 +1700,7 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
|
|||
} else if (s == "nolldtailmerge") {
|
||||
tailMerge = 0;
|
||||
} else if (s == "ltonewpassmanager") {
|
||||
ltoNewPM = true;
|
||||
} else if (s == "noltonewpassmanager") {
|
||||
ltoNewPM = false;
|
||||
/* We always use the new PM. */
|
||||
} else if (s == "ltodebugpassmanager") {
|
||||
ltoDebugPM = true;
|
||||
} else if (s == "noltodebugpassmanager") {
|
||||
|
@ -1733,7 +1730,6 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
|
|||
config->doICF = icfLevel.getValue();
|
||||
config->tailMerge =
|
||||
(tailMerge == 1 && config->doICF != ICFLevel::None) || tailMerge == 2;
|
||||
config->ltoNewPassManager = ltoNewPM;
|
||||
config->ltoDebugPassManager = ltoDebugPM;
|
||||
|
||||
// Handle /lldsavetemps
|
||||
|
|
|
@ -83,7 +83,6 @@ static lto::Config createConfig() {
|
|||
c.MAttrs = getMAttrs();
|
||||
c.CGOptLevel = args::getCGOptLevel(config->ltoo);
|
||||
c.AlwaysEmitRegularLTOObj = !config->ltoObjPath.empty();
|
||||
c.UseNewPM = config->ltoNewPassManager;
|
||||
c.DebugPassManager = config->ltoDebugPassManager;
|
||||
c.CSIRProfile = std::string(config->ltoCSProfileFile);
|
||||
c.RunCSIRInstr = config->ltoCSProfileGenerate;
|
||||
|
|
|
@ -187,7 +187,6 @@ struct Configuration {
|
|||
bool ltoPGOWarnMismatch;
|
||||
bool ltoDebugPassManager;
|
||||
bool ltoEmitAsm;
|
||||
bool ltoNewPassManager;
|
||||
bool ltoUniqueBasicBlockSectionNames;
|
||||
bool ltoWholeProgramVisibility;
|
||||
bool mergeArmExidx;
|
||||
|
|
|
@ -1102,8 +1102,6 @@ static void readConfigs(opt::InputArgList &args) {
|
|||
OPT_no_lto_pgo_warn_mismatch, true);
|
||||
config->ltoDebugPassManager = args.hasArg(OPT_lto_debug_pass_manager);
|
||||
config->ltoEmitAsm = args.hasArg(OPT_lto_emit_asm);
|
||||
config->ltoNewPassManager = args.hasFlag(OPT_no_lto_legacy_pass_manager,
|
||||
OPT_lto_legacy_pass_manager, true);
|
||||
config->ltoNewPmPasses = args.getLastArgValue(OPT_lto_newpm_passes);
|
||||
config->ltoWholeProgramVisibility =
|
||||
args.hasFlag(OPT_lto_whole_program_visibility,
|
||||
|
|
|
@ -146,7 +146,6 @@ static lto::Config createConfig() {
|
|||
c.StatsFile = std::string(config->optStatsFilename);
|
||||
|
||||
c.SampleProfile = std::string(config->ltoSampleProfile);
|
||||
c.UseNewPM = config->ltoNewPassManager;
|
||||
for (StringRef pluginFn : config->passPlugins)
|
||||
c.PassPlugins.push_back(std::string(pluginFn));
|
||||
c.DebugPassManager = config->ltoDebugPassManager;
|
||||
|
|
|
@ -547,9 +547,8 @@ def lto_debug_pass_manager: FF<"lto-debug-pass-manager">,
|
|||
HelpText<"Debug new pass manager">;
|
||||
def lto_emit_asm: FF<"lto-emit-asm">,
|
||||
HelpText<"Emit assembly code">;
|
||||
defm lto_legacy_pass_manager: BB<"lto-legacy-pass-manager",
|
||||
"Use the legacy pass manager in LLVM",
|
||||
"Use the new pass manager in LLVM">;
|
||||
def no_lto_legacy_pass_manager: FF<"no-lto-legacy-pass-manager">,
|
||||
HelpText<"Use the new pass manager in LLVM">;
|
||||
def lto_newpm_passes: JJ<"lto-newpm-passes=">,
|
||||
HelpText<"Passes to run during LTO">;
|
||||
def lto_O: JJ<"lto-O">, MetaVarName<"<opt-level>">,
|
||||
|
@ -622,8 +621,6 @@ def: J<"plugin-opt=lto-partitions=">, Alias<lto_partitions>, HelpText<"Alias for
|
|||
def plugin_opt_mcpu_eq: J<"plugin-opt=mcpu=">;
|
||||
def: F<"plugin-opt=new-pass-manager">,
|
||||
Alias<no_lto_legacy_pass_manager>, HelpText<"Alias for --no-lto-legacy-pass-manager">;
|
||||
def: F<"plugin-opt=legacy-pass-manager">,
|
||||
Alias<lto_legacy_pass_manager>, HelpText<"Alias for --no-legacy-pass-manager">;
|
||||
def: F<"plugin-opt=cs-profile-generate">,
|
||||
Alias<lto_cs_profile_generate>, HelpText<"Alias for --lto-cs-profile-generate">;
|
||||
def: J<"plugin-opt=cs-profile-path=">,
|
||||
|
|
|
@ -107,7 +107,6 @@ struct Configuration {
|
|||
bool implicitDylibs = false;
|
||||
bool isPic = false;
|
||||
bool headerPadMaxInstallNames = false;
|
||||
bool ltoNewPassManager = true;
|
||||
bool markDeadStrippableDylib = false;
|
||||
bool printDylibSearch = false;
|
||||
bool printEachFile = false;
|
||||
|
|
|
@ -1222,8 +1222,6 @@ bool macho::link(ArrayRef<const char *> argsArr, llvm::raw_ostream &stdoutOS,
|
|||
config->umbrella = arg->getValue();
|
||||
}
|
||||
config->ltoObjPath = args.getLastArgValue(OPT_object_path_lto);
|
||||
config->ltoNewPassManager = args.hasFlag(OPT_no_lto_legacy_pass_manager,
|
||||
OPT_lto_legacy_pass_manager, true);
|
||||
config->ltoo = args::getInteger(args, OPT_lto_O, 2);
|
||||
if (config->ltoo > 3)
|
||||
error("--lto-O: invalid optimization level: " + Twine(config->ltoo));
|
||||
|
|
|
@ -38,7 +38,6 @@ static lto::Config createConfig() {
|
|||
c.CPU = getCPUStr();
|
||||
c.MAttrs = getMAttrs();
|
||||
c.DiagHandler = diagnosticHandler;
|
||||
c.UseNewPM = config->ltoNewPassManager;
|
||||
c.PreCodeGenPassesHook = [](legacy::PassManager &pm) {
|
||||
pm.add(createObjCARCContractPass());
|
||||
};
|
||||
|
|
|
@ -40,9 +40,6 @@ def reproduce_eq: Joined<["--"], "reproduce=">,
|
|||
def version: Flag<["--"], "version">,
|
||||
HelpText<"Display the version number and exit">,
|
||||
Group<grp_lld>;
|
||||
def lto_legacy_pass_manager: Flag<["--"], "lto-legacy-pass-manager">,
|
||||
HelpText<"Use the legacy pass manager in LLVM">,
|
||||
Group<grp_lld>;
|
||||
def no_lto_legacy_pass_manager : Flag<["--"], "no-lto-legacy-pass-manager">,
|
||||
HelpText<"Use the new pass manager in LLVM">,
|
||||
Group<grp_lld>;
|
||||
|
|
|
@ -4,11 +4,6 @@
|
|||
; RUN: lld-link %t.obj -entry:main -opt:ltonewpassmanager -opt:ltodebugpassmanager 2>&1 | FileCheck %s --check-prefix=ENABLED
|
||||
; ENABLED: Running pass: InstCombinePass
|
||||
|
||||
; Passing -time just to avoid empty FileCheck input
|
||||
; RUN: lld-link %t.obj -entry:main -time -opt:ltonewpassmanager -opt:ltodebugpassmanager -opt:noltonewpassmanager 2>&1 | FileCheck %s --check-prefix=DISABLED
|
||||
; RUN: lld-link %t.obj -entry:main -time -opt:ltonewpassmanager -opt:ltodebugpassmanager -opt:noltodebugpassmanager 2>&1 | FileCheck %s --check-prefix=DISABLED
|
||||
; DISABLED-NOT: Running pass: InstCombinePass
|
||||
|
||||
target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-pc-windows-msvc19.11.0"
|
||||
|
||||
|
|
|
@ -6,11 +6,8 @@
|
|||
; RUN: ld.lld --plugin-opt=new-pass-manager --lto-debug-pass-manager -o /dev/null %t.o 2>&1 | FileCheck %s
|
||||
; RUN: ld.lld --no-lto-legacy-pass-manager --plugin-opt=debug-pass-manager -o /dev/null %t.o 2>&1 | FileCheck %s
|
||||
; RUN: ld.lld --no-lto-legacy-pass-manager --lto-debug-pass-manager -o /dev/null %t.o 2>&1 | FileCheck %s
|
||||
; RUN: ld.lld --no-lto-legacy-pass-manager --lto-legacy-pass-manager --lto-debug-pass-manager -o /dev/null %t.o 2>&1 | FileCheck %s --check-prefix=LEGACY
|
||||
; RUN: ld.lld --plugin-opt=legacy-pass-manager --plugin-opt=debug-pass-manager -o /dev/null %t.o 2>&1 | FileCheck %s --check-prefix=LEGACY
|
||||
|
||||
; CHECK: Running pass: GlobalOptPass
|
||||
; LEGACY-NOT: Running pass: GlobalOptPass
|
||||
|
||||
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
; REQUIRES: x86
|
||||
; RUN: llvm-as %s -o %t.o
|
||||
; RUN: ld.lld %t.o -o %t2 -mllvm -debug-pass=Arguments --lto-legacy-pass-manager \
|
||||
; RUN: 2>&1 | FileCheck -check-prefix=DEFAULT-LPM %s
|
||||
; RUN: ld.lld %t.o -o %t2 -mllvm -debug-pass=Arguments --lto-legacy-pass-manager \
|
||||
; RUN: -disable-verify 2>&1 | FileCheck -check-prefix=DISABLE-LPM %s
|
||||
; RUN: ld.lld %t.o -o %t2 -mllvm -debug-pass=Arguments --lto-legacy-pass-manager \
|
||||
; RUN: --plugin-opt=disable-verify 2>&1 | FileCheck -check-prefix=DISABLE-LPM %s
|
||||
; RUN: ld.lld %t.o -o %t2 --no-lto-legacy-pass-manager --lto-debug-pass-manager \
|
||||
; RUN: 2>&1 | FileCheck -check-prefix=DEFAULT-NPM %s
|
||||
; RUN: ld.lld %t.o -o %t2 --no-lto-legacy-pass-manager --lto-debug-pass-manager \
|
||||
|
@ -21,8 +15,6 @@ define void @_start() {
|
|||
}
|
||||
|
||||
; -disable-verify should disable the verification of bitcode.
|
||||
; DEFAULT-LPM: Pass Arguments: {{.*}} -verify {{.*}} -verify
|
||||
; DISABLE-LPM-NOT: Pass Arguments: {{.*}} -verify {{.*}} -verify
|
||||
; DEFAULT-NPM: Running pass: VerifierPass
|
||||
; DEFAULT-NPM: Running pass: VerifierPass
|
||||
; DEFAULT-NPM-NOT: Running pass: VerifierPass
|
||||
|
|
|
@ -5,14 +5,10 @@
|
|||
;; which doesn't know how to handle it.
|
||||
|
||||
; RUN: llvm-as %s -o %t.o
|
||||
; RUN: %lld -dylib -lSystem %t.o -o %t --lto-legacy-pass-manager
|
||||
; RUN: llvm-objdump -d %t | FileCheck %s
|
||||
; RUN: %lld -dylib -lSystem %t.o -o %t --no-lto-legacy-pass-manager
|
||||
; RUN: llvm-objdump -d %t | FileCheck %s
|
||||
|
||||
; RUN: opt -module-summary %s -o %t.o
|
||||
; RUN: %lld -dylib -lSystem %t.o -o %t --lto-legacy-pass-manager
|
||||
; RUN: llvm-objdump -d %t | FileCheck %s
|
||||
; RUN: %lld -dylib -lSystem %t.o -o %t --no-lto-legacy-pass-manager
|
||||
; RUN: llvm-objdump -d %t | FileCheck %s
|
||||
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
; RUN: llvm-as -o %t.bc %s
|
||||
; RUN: wasm-ld --no-lto-legacy-pass-manager --lto-debug-pass-manager -o /dev/null %t.bc 2>&1 | FileCheck %s
|
||||
; RUN: wasm-ld --no-lto-legacy-pass-manager --lto-debug-pass-manager --lto-legacy-pass-manager -o /dev/null %t.bc 2>&1 | FileCheck %s --allow-empty --check-prefix=LPM
|
||||
|
||||
; CHECK: Running pass: GlobalOptPass
|
||||
; LPM-NOT: Running pass: GlobalOptPass
|
||||
|
||||
target datalayout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-n32:64-S128"
|
||||
target triple = "wasm32-unknown-unknown"
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
; RUN: llvm-as %s -o %t.o
|
||||
; RUN: wasm-ld %t.o -o %t2 --lto-legacy-pass-manager -mllvm -debug-pass=Arguments \
|
||||
; RUN: 2>&1 | FileCheck -check-prefix=DEFAULT-LPM %s
|
||||
; RUN: wasm-ld %t.o -o %t2 --lto-legacy-pass-manager -mllvm -debug-pass=Arguments \
|
||||
; RUN: -disable-verify 2>&1 | FileCheck -check-prefix=DISABLE-LPM %s
|
||||
; RUN: wasm-ld %t.o -o %t2 --no-lto-legacy-pass-manager --lto-debug-pass-manager \
|
||||
; RUN: 2>&1 | FileCheck -check-prefix=DEFAULT-NPM %s
|
||||
; RUN: wasm-ld %t.o -o %t2 --no-lto-legacy-pass-manager --lto-debug-pass-manager \
|
||||
|
@ -16,8 +12,6 @@ define void @_start() {
|
|||
}
|
||||
|
||||
; -disable-verify should disable the verification of bitcode.
|
||||
; DEFAULT-LPM: Pass Arguments: {{.*}} -verify {{.*}} -verify
|
||||
; DISABLE-LPM-NOT: Pass Arguments: {{.*}} -verify {{.*}} -verify
|
||||
; DEFAULT-NPM: Running pass: VerifierPass
|
||||
; DEFAULT-NPM: Running pass: VerifierPass
|
||||
; DEFAULT-NPM-NOT: Running pass: VerifierPass
|
||||
|
|
|
@ -61,7 +61,6 @@ struct Configuration {
|
|||
unsigned ltoo;
|
||||
unsigned optimize;
|
||||
llvm::StringRef thinLTOJobs;
|
||||
bool ltoNewPassManager;
|
||||
bool ltoDebugPassManager;
|
||||
UnresolvedPolicy unresolvedSymbols;
|
||||
|
||||
|
|
|
@ -365,8 +365,6 @@ static void readConfigs(opt::InputArgList &args) {
|
|||
config->importUndefined = args.hasArg(OPT_import_undefined);
|
||||
config->ltoo = args::getInteger(args, OPT_lto_O, 2);
|
||||
config->ltoPartitions = args::getInteger(args, OPT_lto_partitions, 1);
|
||||
config->ltoNewPassManager = args.hasFlag(OPT_no_lto_legacy_pass_manager,
|
||||
OPT_lto_legacy_pass_manager, true);
|
||||
config->ltoDebugPassManager = args.hasArg(OPT_lto_debug_pass_manager);
|
||||
config->mapFile = args.getLastArgValue(OPT_Map);
|
||||
config->optimize = args::getInteger(args, OPT_O, 1);
|
||||
|
|
|
@ -52,7 +52,6 @@ static std::unique_ptr<lto::LTO> createLTO() {
|
|||
c.OptLevel = config->ltoo;
|
||||
c.MAttrs = getMAttrs();
|
||||
c.CGOptLevel = args::getCGOptLevel(config->ltoo);
|
||||
c.UseNewPM = config->ltoNewPassManager;
|
||||
c.DebugPassManager = config->ltoDebugPassManager;
|
||||
|
||||
if (config->relocatable)
|
||||
|
|
|
@ -228,7 +228,8 @@ def thinlto_cache_dir: J<"thinlto-cache-dir=">,
|
|||
defm thinlto_cache_policy: Eq<"thinlto-cache-policy", "Pruning policy for the ThinLTO cache">;
|
||||
def thinlto_jobs: J<"thinlto-jobs=">,
|
||||
HelpText<"Number of ThinLTO jobs. Default to --threads=">;
|
||||
defm lto_legacy_pass_manager: BB<"lto-legacy-pass-manager", "Use legacy pass manager", "Use new pass manager">;
|
||||
def no_lto_legacy_pass_manager: F<"no-lto-legacy-pass-manager">,
|
||||
HelpText<"Use new pass manager">;
|
||||
def lto_debug_pass_manager: F<"lto-debug-pass-manager">,
|
||||
HelpText<"Debug new pass manager">;
|
||||
|
||||
|
|
Loading…
Reference in New Issue