Skip to content

Commit 0af0751

Browse files
committed
Keep only pgo-kind option
1 parent 6e4ebda commit 0af0751

File tree

1 file changed

+4
-111
lines changed

1 file changed

+4
-111
lines changed

llvm/tools/llc/llc.cpp

Lines changed: 4 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -243,138 +243,31 @@ static cl::opt<RunPassOption, true, cl::parser<std::string>> RunPass(
243243
// PGO command line options
244244
enum PGOKind {
245245
NoPGO,
246-
InstrGen,
247-
InstrUse,
248246
SampleUse,
249247
};
250248

251-
enum CSPGOKind {
252-
NoCSPGO,
253-
CSInstrGen,
254-
CSInstrUse,
255-
};
256-
257249
static cl::opt<PGOKind>
258250
PGOKindFlag("pgo-kind", cl::init(NoPGO), cl::Hidden,
259251
cl::desc("The kind of profile guided optimization"),
260252
cl::values(clEnumValN(NoPGO, "nopgo", "Do not use PGO."),
261-
clEnumValN(InstrGen, "pgo-instr-gen-pipeline",
262-
"Instrument the IR to generate profile."),
263-
clEnumValN(InstrUse, "pgo-instr-use-pipeline",
264-
"Use instrumented profile to guide PGO."),
265253
clEnumValN(SampleUse, "pgo-sample-use-pipeline",
266254
"Use sampled profile to guide PGO.")));
267255

268-
static cl::opt<std::string>
269-
ProfileFile("profile-file", cl::desc("Path to the profile."), cl::Hidden);
270-
271-
static cl::opt<std::string>
272-
MemoryProfileFile("memory-profile-file",
273-
cl::desc("Path to the memory profile."), cl::Hidden);
274-
275-
static cl::opt<CSPGOKind> CSPGOKindFlag(
276-
"cspgo-kind", cl::init(NoCSPGO), cl::Hidden,
277-
cl::desc("The kind of context sensitive profile guided optimization"),
278-
cl::values(
279-
clEnumValN(NoCSPGO, "nocspgo", "Do not use CSPGO."),
280-
clEnumValN(
281-
CSInstrGen, "cspgo-instr-gen-pipeline",
282-
"Instrument (context sensitive) the IR to generate profile."),
283-
clEnumValN(
284-
CSInstrUse, "cspgo-instr-use-pipeline",
285-
"Use instrumented (context sensitive) profile to guide PGO.")));
286-
287-
static cl::opt<std::string> CSProfileGenFile(
288-
"cs-profilegen-file",
289-
cl::desc("Path to the instrumented context sensitive profile."),
290-
cl::Hidden);
291-
292-
static cl::opt<std::string>
293-
ProfileRemappingFile("profile-remapping-file",
294-
cl::desc("Path to the profile remapping file."),
295-
cl::Hidden);
296-
297-
static cl::opt<PGOOptions::ColdFuncOpt> PGOColdFuncAttr(
298-
"pgo-cold-func-opt", cl::init(PGOOptions::ColdFuncOpt::Default), cl::Hidden,
299-
cl::desc(
300-
"Function attribute to apply to cold functions as determined by PGO"),
301-
cl::values(clEnumValN(PGOOptions::ColdFuncOpt::Default, "default",
302-
"Default (no attribute)"),
303-
clEnumValN(PGOOptions::ColdFuncOpt::OptSize, "optsize",
304-
"Mark cold functions with optsize."),
305-
clEnumValN(PGOOptions::ColdFuncOpt::MinSize, "minsize",
306-
"Mark cold functions with minsize."),
307-
clEnumValN(PGOOptions::ColdFuncOpt::OptNone, "optnone",
308-
"Mark cold functions with optnone.")));
309-
310-
static cl::opt<bool> DebugInfoForProfiling(
311-
"debug-info-for-profiling", cl::init(false), cl::Hidden,
312-
cl::desc("Emit special debug info to enable PGO profile generation."));
313-
314-
static cl::opt<bool> PseudoProbeForProfiling(
315-
"pseudo-probe-for-profiling", cl::init(false), cl::Hidden,
316-
cl::desc("Emit pseudo probes to enable PGO profile generation."));
317-
318256
// Function to set PGO options on TargetMachine based on command line flags
319257
static void setPGOOptions(TargetMachine &TM) {
320258
std::optional<PGOOptions> PGOOpt;
321259

322260
switch (PGOKindFlag) {
323-
case InstrGen:
324-
PGOOpt =
325-
PGOOptions(ProfileFile, "", "", MemoryProfileFile, PGOOptions::IRInstr,
326-
PGOOptions::NoCSAction, PGOColdFuncAttr);
327-
break;
328-
case InstrUse:
329-
PGOOpt =
330-
PGOOptions(ProfileFile, "", ProfileRemappingFile, MemoryProfileFile,
331-
PGOOptions::IRUse, PGOOptions::NoCSAction, PGOColdFuncAttr);
332-
break;
333261
case SampleUse:
334-
PGOOpt = PGOOptions(ProfileFile, "", ProfileRemappingFile,
335-
MemoryProfileFile, PGOOptions::SampleUse,
336-
PGOOptions::NoCSAction, PGOColdFuncAttr);
262+
// Use default values for other PGOOptions parameters
263+
PGOOpt = PGOOptions("", "", "", "", PGOOptions::SampleUse,
264+
PGOOptions::NoCSAction);
337265
break;
338266
case NoPGO:
339-
if (DebugInfoForProfiling || PseudoProbeForProfiling ||
340-
!MemoryProfileFile.empty())
341-
PGOOpt = PGOOptions("", "", "", MemoryProfileFile, PGOOptions::NoAction,
342-
PGOOptions::NoCSAction, PGOColdFuncAttr,
343-
DebugInfoForProfiling, PseudoProbeForProfiling);
344-
else
345-
PGOOpt = std::nullopt;
267+
PGOOpt = std::nullopt;
346268
break;
347269
}
348270

349-
// Handle context-sensitive PGO options
350-
if (CSPGOKindFlag != NoCSPGO) {
351-
if (PGOOpt && (PGOOpt->Action == PGOOptions::IRInstr ||
352-
PGOOpt->Action == PGOOptions::SampleUse)) {
353-
errs() << "CSPGOKind cannot be used with IRInstr or SampleUse";
354-
exit(1);
355-
}
356-
if (CSPGOKindFlag == CSInstrGen) {
357-
if (CSProfileGenFile.empty()) {
358-
errs() << "CSInstrGen needs to specify CSProfileGenFile";
359-
exit(1);
360-
}
361-
if (PGOOpt) {
362-
PGOOpt->CSAction = PGOOptions::CSIRInstr;
363-
PGOOpt->CSProfileGenFile = CSProfileGenFile;
364-
} else {
365-
PGOOpt = PGOOptions("", CSProfileGenFile, ProfileRemappingFile,
366-
/*MemoryProfile=*/"", PGOOptions::NoAction,
367-
PGOOptions::CSIRInstr);
368-
}
369-
} else /* CSPGOKindFlag == CSInstrUse */ {
370-
if (!PGOOpt) {
371-
errs() << "CSInstrUse needs to be together with InstrUse";
372-
exit(1);
373-
}
374-
PGOOpt->CSAction = PGOOptions::CSIRUse;
375-
}
376-
}
377-
378271
if (PGOOpt)
379272
TM.setPGOOption(PGOOpt);
380273
}

0 commit comments

Comments
 (0)