[lld] r355876 - [PGO] Add options for context-sensitive PGO
Rong Xu via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 11 15:51:38 PDT 2019
Author: xur
Date: Mon Mar 11 15:51:38 2019
New Revision: 355876
URL: http://llvm.org/viewvc/llvm-project?rev=355876&view=rev
Log:
[PGO] Add options for context-sensitive PGO
Add lld options for CSPGO (context-sensitive PGO).
Differential Revision: https://reviews.llvm.org/D56675
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=355876&r1=355875&r2=355876&view=diff
==============================================================================
--- lld/trunk/ELF/Config.h (original)
+++ lld/trunk/ELF/Config.h Mon Mar 11 15:51:38 2019
@@ -92,6 +92,7 @@ struct Configuration {
llvm::StringRef Fini;
llvm::StringRef Init;
llvm::StringRef LTOAAPipeline;
+ llvm::StringRef LTOCSProfileFile;
llvm::StringRef LTONewPmPasses;
llvm::StringRef LTOObjPath;
llvm::StringRef LTOSampleProfile;
@@ -151,6 +152,7 @@ struct Configuration {
bool HasDynSymTab;
bool IgnoreDataAddressEquality;
bool IgnoreFunctionAddressEquality;
+ bool LTOCSProfileGenerate;
bool LTODebugPassManager;
bool LTONewPassManager;
bool MergeArmExidx;
Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=355876&r1=355875&r2=355876&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Mon Mar 11 15:51:38 2019
@@ -800,6 +800,8 @@ 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->LTOCSProfileGenerate = Args.hasArg(OPT_lto_cs_profile_generate);
+ Config->LTOCSProfileFile = Args.getLastArgValue(OPT_lto_cs_profile_file);
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);
Modified: lld/trunk/ELF/LTO.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LTO.cpp?rev=355876&r1=355875&r2=355876&view=diff
==============================================================================
--- lld/trunk/ELF/LTO.cpp (original)
+++ lld/trunk/ELF/LTO.cpp Mon Mar 11 15:51:38 2019
@@ -104,6 +104,9 @@ static lto::Config createConfig() {
C.DebugPassManager = Config->LTODebugPassManager;
C.DwoDir = Config->DwoDir;
+ C.CSIRProfile = Config->LTOCSProfileFile;
+ C.RunCSIRInstr = Config->LTOCSProfileGenerate;
+
if (Config->EmitLLVM) {
C.PostInternalizeModuleHook = [](size_t Task, const Module &M) {
if (std::unique_ptr<raw_fd_ostream> OS = openFile(Config->OutputFile))
Modified: lld/trunk/ELF/Options.td
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Options.td?rev=355876&r1=355875&r2=355876&view=diff
==============================================================================
--- lld/trunk/ELF/Options.td (original)
+++ lld/trunk/ELF/Options.td Mon Mar 11 15:51:38 2019
@@ -444,6 +444,10 @@ def lto_O: J<"lto-O">, MetaVarName<"<opt
HelpText<"Optimization level for LTO">;
def lto_partitions: J<"lto-partitions=">,
HelpText<"Number of LTO codegen partitions">;
+def lto_cs_profile_generate: F<"lto-cs-profile-generate">,
+ HelpText<"Perform context senstive PGO instrumentation">;
+def lto_cs_profile_file: J<"lto-cs-profile-file=">,
+ HelpText<"Context sensitive profile file path">;
def lto_sample_profile: J<"lto-sample-profile=">,
HelpText<"Sample profile file path">;
def disable_verify: F<"disable-verify">;
@@ -472,6 +476,10 @@ def plugin_opt_mcpu_eq: J<"plugin-opt=mc
def: F<"plugin-opt=new-pass-manager">,
Alias<lto_new_pass_manager>, HelpText<"Alias for -lto-new-pass-manager">;
def plugin_opt_obj_path_eq: J<"plugin-opt=obj-path=">;
+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=">,
+ Alias<lto_cs_profile_file>, HelpText<"Alias for -lto-cs-profile-file">;
def: J<"plugin-opt=sample-profile=">,
Alias<lto_sample_profile>, HelpText<"Alias for -lto-sample-profile">;
def: F<"plugin-opt=save-temps">, Alias<save_temps>, HelpText<"Alias for -save-temps">;
More information about the llvm-commits
mailing list