[lld] r329598 - Added support for LTO options: sample_profile, new_pass_manager and debug_pass_manager
Rumeet Dhindsa via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 9 10:56:07 PDT 2018
Author: rdhindsa
Date: Mon Apr 9 10:56:07 2018
New Revision: 329598
URL: http://llvm.org/viewvc/llvm-project?rev=329598&view=rev
Log:
Added support for LTO options: sample_profile, new_pass_manager and debug_pass_manager
Differential Revision: https://reviews.llvm.org/D45275
Added:
lld/trunk/test/ELF/lto/new-pass-manager.ll
lld/trunk/test/ELF/lto/sample-profile.ll
Modified:
lld/trunk/ELF/Config.h
lld/trunk/ELF/Driver.cpp
lld/trunk/ELF/LTO.cpp
lld/trunk/ELF/Options.td
Modified: lld/trunk/ELF/Config.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Config.h?rev=329598&r1=329597&r2=329598&view=diff
==============================================================================
--- lld/trunk/ELF/Config.h (original)
+++ lld/trunk/ELF/Config.h Mon Apr 9 10:56:07 2018
@@ -85,6 +85,7 @@ struct Configuration {
llvm::StringRef Init;
llvm::StringRef LTOAAPipeline;
llvm::StringRef LTONewPmPasses;
+ llvm::StringRef LTOSampleProfile;
llvm::StringRef MapFile;
llvm::StringRef OutputFile;
llvm::StringRef OptRemarksFilename;
@@ -131,6 +132,8 @@ struct Configuration {
bool ICF;
bool IgnoreDataAddressEquality;
bool IgnoreFunctionAddressEquality;
+ bool LTODebugPassManager;
+ bool LTONewPassManager;
bool MergeArmExidx;
bool MipsN32Abi = false;
bool NoinhibitExec;
Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=329598&r1=329597&r2=329598&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Mon Apr 9 10:56:07 2018
@@ -657,9 +657,12 @@ void LinkerDriver::readConfigs(opt::Inpu
Args.hasArg(OPT_ignore_function_address_equality);
Config->Init = Args.getLastArgValue(OPT_init, "_init");
Config->LTOAAPipeline = Args.getLastArgValue(OPT_lto_aa_pipeline);
+ Config->LTODebugPassManager = Args.hasArg(OPT_lto_debug_pass_manager);
+ Config->LTONewPassManager = Args.hasArg(OPT_lto_new_pass_manager);
Config->LTONewPmPasses = Args.getLastArgValue(OPT_lto_newpm_passes);
Config->LTOO = args::getInteger(Args, OPT_lto_O, 2);
Config->LTOPartitions = args::getInteger(Args, OPT_lto_partitions, 1);
+ Config->LTOSampleProfile = Args.getLastArgValue(OPT_lto_sample_profile);
Config->MapFile = Args.getLastArgValue(OPT_Map);
Config->MergeArmExidx =
Args.hasFlag(OPT_merge_exidx_entries, OPT_no_merge_exidx_entries, true);
@@ -734,6 +737,12 @@ void LinkerDriver::readConfigs(opt::Inpu
Config->ThinLTOJobs = parseInt(S.substr(5), Arg);
else if (S.startswith("mcpu="))
parseClangOption(Saver.save("-" + S), Arg->getSpelling());
+ else if (S == "new-pass-manager")
+ Config->LTONewPassManager = true;
+ else if (S == "debug-pass-manager")
+ Config->LTODebugPassManager = true;
+ else if (S.startswith("sample-profile="))
+ Config->LTOSampleProfile = S.substr(strlen("sample-profile="));
else if (!S.startswith("/") && !S.startswith("-fresolution=") &&
!S.startswith("-pass-through=") && !S.startswith("thinlto"))
parseClangOption(S, Arg->getSpelling());
Modified: lld/trunk/ELF/LTO.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LTO.cpp?rev=329598&r1=329597&r2=329598&view=diff
==============================================================================
--- lld/trunk/ELF/LTO.cpp (original)
+++ lld/trunk/ELF/LTO.cpp Mon Apr 9 10:56:07 2018
@@ -104,6 +104,11 @@ static std::unique_ptr<lto::LTO> createL
lto::ThinBackend Backend;
if (Config->ThinLTOJobs != -1u)
Backend = lto::createInProcessThinBackend(Config->ThinLTOJobs);
+
+ Conf.SampleProfile = Config->LTOSampleProfile;
+ Conf.UseNewPM = Config->LTONewPassManager;
+ Conf.DebugPassManager = Config->LTODebugPassManager;
+
return llvm::make_unique<lto::LTO>(std::move(Conf), Backend,
Config->LTOPartitions);
}
Modified: lld/trunk/ELF/Options.td
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Options.td?rev=329598&r1=329597&r2=329598&view=diff
==============================================================================
--- lld/trunk/ELF/Options.td (original)
+++ lld/trunk/ELF/Options.td Mon Apr 9 10:56:07 2018
@@ -394,10 +394,16 @@ def start_group_paren: Flag<["-"], "(">;
// LTO-related options.
def lto_aa_pipeline: J<"lto-aa-pipeline=">,
HelpText<"AA pipeline to run during LTO. Used in conjunction with -lto-newpm-passes">;
+def lto_debug_pass_manager: F<"lto-debug-pass-manager">,
+ HelpText<"Debug new pass manager">;
+def lto_new_pass_manager: F<"lto-new-pass-manager">,
+ HelpText<"Use new pass manager">;
def lto_newpm_passes: J<"lto-newpm-passes=">,
HelpText<"Passes to run during LTO">;
def lto_partitions: J<"lto-partitions=">,
HelpText<"Number of LTO codegen partitions">;
+def lto_sample_profile: J<"lto-sample-profile=">,
+ HelpText<"Sample profile file path">;
def disable_verify: F<"disable-verify">;
defm mllvm: Eq<"mllvm">;
def opt_remarks_filename: Separate<["--"], "opt-remarks-filename">,
Added: lld/trunk/test/ELF/lto/new-pass-manager.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto/new-pass-manager.ll?rev=329598&view=auto
==============================================================================
--- lld/trunk/test/ELF/lto/new-pass-manager.ll (added)
+++ lld/trunk/test/ELF/lto/new-pass-manager.ll Mon Apr 9 10:56:07 2018
@@ -0,0 +1,14 @@
+; REQUIRES: x86
+; RUN: opt -module-summary %s -o %t.o
+
+; Test new-pass-manager and debug-pass-manager option
+; RUN: ld.lld --plugin-opt=new-pass-manager --plugin-opt=debug-pass-manager -o %t2.o %t.o 2>&1 | FileCheck %s
+; RUN: ld.lld --plugin-opt=new-pass-manager --lto-debug-pass-manager -o %t2.o %t.o 2>&1 | FileCheck %s
+; RUN: ld.lld --lto-new-pass-manager --plugin-opt=debug-pass-manager -o %t2.o %t.o 2>&1 | FileCheck %s
+; RUN: ld.lld --lto-new-pass-manager --lto-debug-pass-manager -o %t2.o %t.o 2>&1 | FileCheck %s
+
+; CHECK: Starting llvm::Module pass manager run
+; CHECK: Finished llvm::Module pass manager run
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
Added: lld/trunk/test/ELF/lto/sample-profile.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto/sample-profile.ll?rev=329598&view=auto
==============================================================================
--- lld/trunk/test/ELF/lto/sample-profile.ll (added)
+++ lld/trunk/test/ELF/lto/sample-profile.ll Mon Apr 9 10:56:07 2018
@@ -0,0 +1,25 @@
+; REQUIRES: x86
+; RUN: opt -module-summary %s -o %t1.o
+; RUN: opt -module-summary %p/Inputs/thinlto.ll -o %t2.o
+
+; RUN: rm -f %t1.lto.o %t2.lto.o
+; RUN: ld.lld --lto-sample-profile=/dev/null %t1.o %t2.o -o %t3
+; RUN opt -S %t3.lto.o | FileCheck %s
+
+; RUN: rm -f %t1.lto.o %t2.lto.o
+; RUN: ld.lld --plugin-opt=sample-profile=/dev/null %t1.o %t2.o -o %t3
+; RUN opt -S %t3.lto.o | FileCheck %s
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+; CHECK: ProfileSummary
+declare void @g(...)
+declare void @h(...)
+
+define void @f() {
+entry:
+ call void (...) @g()
+ call void (...) @h()
+ ret void
+}
More information about the llvm-commits
mailing list