Merge pull request #76532 from kavon/samplepgo

Add support for SamplePGO
This commit is contained in:
Kavon Farvardin
2024-11-01 17:52:52 -07:00
committed by GitHub
8 changed files with 123 additions and 2 deletions

View File

@@ -500,6 +500,13 @@ public:
/// Path to the profdata file to be used for PGO, or the empty string.
std::string UseProfile = "";
/// Path to the data file to be used for sampling-based PGO,
/// or the empty string.
std::string UseSampleProfile = "";
/// Controls whether DWARF discriminators are added to the IR.
unsigned DebugInfoForProfiling : 1;
/// List of backend command-line options for -embed-bitcode.
std::vector<uint8_t> CmdArgs;
@@ -584,7 +591,8 @@ public:
ColocateTypeDescriptors(true), UseRelativeProtocolWitnessTables(false),
UseFragileResilientProtocolWitnesses(false), EnableHotColdSplit(false),
EmitAsyncFramePushPopMetadata(false), EmitYieldOnce2AsYieldOnce(true),
AsyncFramePointerAll(false), UseProfilingMarkerThunks(false), CmdArgs(),
AsyncFramePointerAll(false), UseProfilingMarkerThunks(false),
DebugInfoForProfiling(false), CmdArgs(),
SanitizeCoverage(llvm::SanitizerCoverageOptions()),
TypeInfoFilter(TypeInfoDumpFilter::All),
PlatformCCallingConvention(llvm::CallingConv::C), UseCASBackend(false),

View File

@@ -1479,6 +1479,10 @@ def profile_generate : Flag<["-"], "profile-generate">,
Flags<[FrontendOption, NoInteractiveOption]>,
HelpText<"Generate instrumented code to collect execution counts">;
def debug_info_for_profiling : Flag<["-"], "debug-info-for-profiling">,
Flags<[FrontendOption, NoInteractiveOption]>,
HelpText<"Emit extra debug info (DWARF discriminators) to make sampling-based profiling more accurate">;
def profile_use : CommaJoined<["-"], "profile-use=">,
Flags<[FrontendOption, NoInteractiveOption, ArgumentIsPath]>,
MetaVarName<"<profdata>">,
@@ -1488,6 +1492,11 @@ def profile_coverage_mapping : Flag<["-"], "profile-coverage-mapping">,
Flags<[FrontendOption, NoInteractiveOption]>,
HelpText<"Generate coverage data for use with profiled execution counts">;
def profile_sample_use : CommaJoined<["-"], "profile-sample-use=">,
Flags<[FrontendOption, NoInteractiveOption, ArgumentIsPath]>,
MetaVarName<"<profile data>">,
HelpText<"Supply sampling-based profiling data from llvm-profdata to enable profile-guided optimization">;
def embed_bitcode : Flag<["-"], "embed-bitcode">,
Flags<[FrontendOption, NoInteractiveOption]>,
HelpText<"Embed LLVM IR bitcode as data">;