[PATCH] D98763: [lld] add context-sensitive PGO options for COFF.
Yolanda via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 17 00:34:22 PDT 2021
YolandaCY created this revision.
Herald added subscribers: wenlei, dang, steven_wu, hiraditya.
YolandaCY requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Add lld CSPGO (Contex-Sensitive PGO) options for COFF target.
Reference the ELF options from https://reviews.llvm.org/D56675
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D98763
Files:
lld/COFF/Config.h
lld/COFF/Driver.cpp
lld/COFF/LTO.cpp
lld/COFF/Options.td
Index: lld/COFF/Options.td
===================================================================
--- lld/COFF/Options.td
+++ lld/COFF/Options.td
@@ -239,6 +239,10 @@
def lto_obj_path : P<
"lto-obj-path",
"output native object for merged LTO unit to this path">;
+def lto_cs_profile_generate: F<"lto-cs-profile-generate">,
+ HelpText<"Perform context sensitive PGO instrumentation">;
+def lto_cs_profile_file : P<"lto-cs-profile-file",
+ "Context sensitive profile file path">;
def dash_dash_version : Flag<["--"], "version">,
HelpText<"Display the version number and exit">;
def threads
Index: lld/COFF/LTO.cpp
===================================================================
--- lld/COFF/LTO.cpp
+++ lld/COFF/LTO.cpp
@@ -84,6 +84,8 @@
c.AlwaysEmitRegularLTOObj = !config->ltoObjPath.empty();
c.UseNewPM = config->ltoNewPassManager;
c.DebugPassManager = config->ltoDebugPassManager;
+ c.CSIRProfile = std::string(config->ltoCSProfileFile);
+ c.RunCSIRInstr = config->ltoCSProfileGenerate;
if (config->saveTemps)
checkError(c.addSaveTemps(std::string(config->outputFile) + ".",
Index: lld/COFF/Driver.cpp
===================================================================
--- lld/COFF/Driver.cpp
+++ lld/COFF/Driver.cpp
@@ -1712,6 +1712,8 @@
config->thinLTOObjectSuffixReplace =
getOldNewOptions(args, OPT_thinlto_object_suffix_replace);
config->ltoObjPath = args.getLastArgValue(OPT_lto_obj_path);
+ config->ltoCSProfileGenerate = args.hasArg(OPT_lto_cs_profile_generate);
+ config->ltoCSProfileFile = args.getLastArgValue(OPT_lto_cs_profile_file);
// Handle miscellaneous boolean flags.
config->allowBind = args.hasFlag(OPT_allowbind, OPT_allowbind_no, true);
config->allowIsolation =
Index: lld/COFF/Config.h
===================================================================
--- lld/COFF/Config.h
+++ lld/COFF/Config.h
@@ -215,6 +215,12 @@
// Used for /lto-obj-path:
llvm::StringRef ltoObjPath;
+ // Used for /lto-cs-profile-generate:
+ bool ltoCSProfileGenerate = false;
+
+ // Used for /lto-cs-profile-path
+ llvm::StringRef ltoCSProfileFile;
+
// Used for /call-graph-ordering-file:
llvm::MapVector<std::pair<const SectionChunk *, const SectionChunk *>,
uint64_t>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98763.331171.patch
Type: text/x-patch
Size: 2277 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210317/ac1b3bba/attachment.bin>
More information about the llvm-commits
mailing list