PGO: new -debug-info-for-profiling frontend flag

This achieves the same as clang's `-fdebug-info-for-profiling`, which
emits DWARF discriminators to aid in narrowing-down which basic block
corresponds to a particular instruction address. This is particularly
useful for sampling-based profiling.

rdar://135443278
This commit is contained in:
Kavon Farvardin
2024-11-01 11:50:22 -07:00
parent 2b01714fba
commit 19e593bc07
6 changed files with 45 additions and 3 deletions

View File

@@ -3180,6 +3180,8 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
const Arg *ProfileSampleUse = Args.getLastArg(OPT_profile_sample_use);
Opts.UseSampleProfile = ProfileSampleUse ? ProfileSampleUse->getValue() : "";
Opts.DebugInfoForProfiling |= Args.hasArg(OPT_debug_info_for_profiling);
Opts.PrintInlineTree |= Args.hasArg(OPT_print_llvm_inline_tree);
// Always producing all outputs when caching is enabled.
Opts.AlwaysCompile |= Args.hasArg(OPT_always_compile_output_files) ||