forked from OSchip/llvm-project
[LTO][wasm][NewPM] Allow using new pass manager for wasm LTO
Reviewed By: sbc100 Differential Revision: https://reviews.llvm.org/D92150
This commit is contained in:
parent
e0665a9050
commit
1314a4938f
|
@ -0,0 +1,15 @@
|
|||
; RUN: llvm-as -o %t.bc %s
|
||||
; RUN: wasm-ld --lto-new-pass-manager --lto-debug-pass-manager -o /dev/null %t.bc 2>&1 | FileCheck %s
|
||||
; RUN: wasm-ld --lto-new-pass-manager --lto-debug-pass-manager --lto-no-new-pass-manager -o /dev/null %t.bc 2>&1 | FileCheck %s --allow-empty --check-prefix=LPM
|
||||
|
||||
; CHECK: Starting llvm::Module pass manager run
|
||||
; CHECK: Finished llvm::Module pass manager run
|
||||
; LPM-NOT: Starting llvm::Module pass manager run
|
||||
|
||||
target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
|
||||
target triple = "wasm32-unknown-unknown"
|
||||
|
||||
define void @_start() local_unnamed_addr {
|
||||
entry:
|
||||
ret void
|
||||
}
|
|
@ -62,6 +62,8 @@ struct Configuration {
|
|||
unsigned ltoo;
|
||||
unsigned optimize;
|
||||
llvm::StringRef thinLTOJobs;
|
||||
bool ltoNewPassManager;
|
||||
bool ltoDebugPassManager;
|
||||
UnresolvedPolicy unresolvedSymbols;
|
||||
|
||||
llvm::StringRef entry;
|
||||
|
|
|
@ -379,6 +379,9 @@ static void readConfigs(opt::InputArgList &args) {
|
|||
config->importTable = args.hasArg(OPT_import_table);
|
||||
config->ltoo = args::getInteger(args, OPT_lto_O, 2);
|
||||
config->ltoPartitions = args::getInteger(args, OPT_lto_partitions, 1);
|
||||
config->ltoNewPassManager = args.hasFlag(OPT_lto_new_pass_manager,
|
||||
OPT_lto_no_new_pass_manager, false);
|
||||
config->ltoDebugPassManager = args.hasArg(OPT_lto_debug_pass_manager);
|
||||
config->mapFile = args.getLastArgValue(OPT_Map);
|
||||
config->optimize = args::getInteger(args, OPT_O, 0);
|
||||
config->outputFile = args.getLastArgValue(OPT_o);
|
||||
|
|
|
@ -52,6 +52,8 @@ 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)
|
||||
c.RelocModel = None;
|
||||
|
|
|
@ -215,6 +215,12 @@ 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=">;
|
||||
def lto_new_pass_manager: F<"lto-new-pass-manager">,
|
||||
HelpText<"Use new pass manager">;
|
||||
def lto_no_new_pass_manager: F<"lto-no-new-pass-manager">,
|
||||
HelpText<"Use legacy pass manager">;
|
||||
def lto_debug_pass_manager: F<"lto-debug-pass-manager">,
|
||||
HelpText<"Debug new pass manager">;
|
||||
|
||||
// Experimental PIC mode.
|
||||
def experimental_pic: F<"experimental-pic">,
|
||||
|
|
Loading…
Reference in New Issue