File tree Expand file tree Collapse file tree 4 files changed +14
-0
lines changed Expand file tree Collapse file tree 4 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -215,6 +215,12 @@ struct Configuration {
215
215
// Used for /lto-obj-path:
216
216
llvm::StringRef ltoObjPath;
217
217
218
+ // Used for /lto-cs-profile-generate:
219
+ bool ltoCSProfileGenerate = false ;
220
+
221
+ // Used for /lto-cs-profile-path
222
+ llvm::StringRef ltoCSProfileFile;
223
+
218
224
// Used for /call-graph-ordering-file:
219
225
llvm::MapVector<std::pair<const SectionChunk *, const SectionChunk *>,
220
226
uint64_t >
Original file line number Diff line number Diff line change @@ -1712,6 +1712,8 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
1712
1712
config->thinLTOObjectSuffixReplace =
1713
1713
getOldNewOptions (args, OPT_thinlto_object_suffix_replace);
1714
1714
config->ltoObjPath = args.getLastArgValue (OPT_lto_obj_path);
1715
+ config->ltoCSProfileGenerate = args.hasArg (OPT_lto_cs_profile_generate);
1716
+ config->ltoCSProfileFile = args.getLastArgValue (OPT_lto_cs_profile_file);
1715
1717
// Handle miscellaneous boolean flags.
1716
1718
config->allowBind = args.hasFlag (OPT_allowbind, OPT_allowbind_no, true );
1717
1719
config->allowIsolation =
Original file line number Diff line number Diff line change @@ -84,6 +84,8 @@ static lto::Config createConfig() {
84
84
c.AlwaysEmitRegularLTOObj = !config->ltoObjPath .empty ();
85
85
c.UseNewPM = config->ltoNewPassManager ;
86
86
c.DebugPassManager = config->ltoDebugPassManager ;
87
+ c.CSIRProfile = std::string (config->ltoCSProfileFile );
88
+ c.RunCSIRInstr = config->ltoCSProfileGenerate ;
87
89
88
90
if (config->saveTemps )
89
91
checkError (c.addSaveTemps (std::string (config->outputFile ) + " ." ,
Original file line number Diff line number Diff line change @@ -239,6 +239,10 @@ def thinlto_prefix_replace: P<
239
239
def lto_obj_path : P<
240
240
"lto-obj-path",
241
241
"output native object for merged LTO unit to this path">;
242
+ def lto_cs_profile_generate: F<"lto-cs-profile-generate">,
243
+ HelpText<"Perform context sensitive PGO instrumentation">;
244
+ def lto_cs_profile_file : P<"lto-cs-profile-file",
245
+ "Context sensitive profile file path">;
242
246
def dash_dash_version : Flag<["--"], "version">,
243
247
HelpText<"Display the version number and exit">;
244
248
def threads
You can’t perform that action at this time.
0 commit comments