<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 18, 2017 at 2:46 PM, Hans Wennborg <span dir="ltr"><<a href="mailto:hans@chromium.org" target="_blank">hans@chromium.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Should we mention this in the release notes? </blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Is the flag documented somewhere?<br></blockquote><div><br></div><div>It's documented in the Options.td file, do you think there are other documents that need to be added/updated?</div><div><br></div><div>Thanks,</div><div>Dehao</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
On Wed, Jan 18, 2017 at 4:44 PM, Dehao Chen via cfe-commits<br>
<<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br>
> Author: dehao<br>
> Date: Wed Jan 18 18:44:21 2017<br>
> New Revision: 292458<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=292458&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=292458&view=rev</a><br>
> Log:<br>
> Add -fdebug-info-for-profiling to emit more debug info for sample pgo profile collection<br>
><br>
> Summary:<br>
> SamplePGO uses profile with debug info to collect profile. Unlike the traditional debugging purpose, sample pgo needs more accurate debug info to represent the profile. We add -femit-accurate-debug-info for this purpose. It can be combined with all debugging modes (-g, -gmlt, etc). It makes sure that the following pieces of info is always emitted:<br>
><br>
> * start line of all subprograms<br>
> * linkage name of all subprograms<br>
> * standalone subprograms (functions that has neither inlined nor been inlined)<br>
><br>
> The impact on speccpu2006 binary size (size increase comparing with -g0 binary, also includes data for -g binary, which does not change with this patch):<br>
><br>
> -gmlt(orig) -gmlt(patched) -g<br>
> 433.milc 4.68% 5.40% 19.73%<br>
> 444.namd 8.45% 8.93% 45.99%<br>
> 447.dealII 97.43% 115.21% 374.89%<br>
> 450.soplex 27.75% 31.88% 126.04%<br>
> 453.povray 21.81% 26.16% 92.03%<br>
> 470.lbm 0.60% 0.67% 1.96%<br>
> 482.sphinx3 5.77% 6.47% 26.17%<br>
> 400.perlbench 17.81% 19.43% 73.08%<br>
> 401.bzip2 3.73% 3.92% 12.18%<br>
> 403.gcc 31.75% 34.48% 122.75%<br>
> 429.mcf 0.78% 0.88% 3.89%<br>
> 445.gobmk 6.08% 7.92% 42.27%<br>
> 456.hmmer 10.36% 11.25% 35.23%<br>
> 458.sjeng 5.08% 5.42% 14.36%<br>
> 462.libquantum 1.71% 1.96% 6.36%<br>
> 464.h264ref 15.61% 16.56% 43.92%<br>
> 471.omnetpp 11.93% 15.84% 60.09%<br>
> 473.astar 3.11% 3.69% 14.18%<br>
> 483.xalancbmk 56.29% 81.63% 353.22%<br>
> geomean 15.60% 18.30% 57.81%<br>
><br>
> Debug info size change for -gmlt binary with this patch:<br>
><br>
> 433.milc 13.46%<br>
> 444.namd 5.35%<br>
> 447.dealII 18.21%<br>
> 450.soplex 14.68%<br>
> 453.povray 19.65%<br>
> 470.lbm 6.03%<br>
> 482.sphinx3 11.21%<br>
> 400.perlbench 8.91%<br>
> 401.bzip2 4.41%<br>
> 403.gcc 8.56%<br>
> 429.mcf 8.24%<br>
> 445.gobmk 29.47%<br>
> 456.hmmer 8.19%<br>
> 458.sjeng 6.05%<br>
> 462.libquantum 11.23%<br>
> 464.h264ref 5.93%<br>
> 471.omnetpp 31.89%<br>
> 473.astar 16.20%<br>
> 483.xalancbmk 44.62%<br>
> geomean 16.83%<br>
><br>
> Reviewers: davidxl, andreadb, rob.lougher, dblaikie, echristo<br>
><br>
> Reviewed By: dblaikie, echristo<br>
><br>
> Subscribers: hfinkel, rob.lougher, andreadb, gbedwell, cfe-commits, probinson, llvm-commits, mehdi_amini<br>
><br>
> Differential Revision: <a href="https://reviews.llvm.org/D25435" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D25435</a><br>
><br>
> Modified:<br>
> cfe/trunk/include/clang/<wbr>Driver/Options.td<br>
> cfe/trunk/include/clang/<wbr>Frontend/CodeGenOptions.def<br>
> cfe/trunk/lib/CodeGen/<wbr>BackendUtil.cpp<br>
> cfe/trunk/lib/CodeGen/<wbr>CGDebugInfo.cpp<br>
> cfe/trunk/lib/Driver/Tools.cpp<br>
> cfe/trunk/lib/Frontend/<wbr>CompilerInvocation.cpp<br>
> cfe/trunk/test/Driver/clang_f_<wbr>opts.c<br>
><br>
> Modified: cfe/trunk/include/clang/<wbr>Driver/Options.td<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=292458&r1=292457&r2=292458&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/include/<wbr>clang/Driver/Options.td?rev=<wbr>292458&r1=292457&r2=292458&<wbr>view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- cfe/trunk/include/clang/<wbr>Driver/Options.td (original)<br>
> +++ cfe/trunk/include/clang/<wbr>Driver/Options.td Wed Jan 18 18:44:21 2017<br>
> @@ -516,6 +516,12 @@ def fprofile_sample_use_EQ : Joined<["-"<br>
> HelpText<"Enable sample-based profile guided optimizations">;<br>
> def fauto_profile_EQ : Joined<["-"], "fauto-profile=">,<br>
> Alias<fprofile_sample_use_EQ>;<br>
> +def fdebug_info_for_profiling : Flag<["-"], "fdebug-info-for-profiling">, Group<f_Group>,<br>
> + Flags<[CC1Option]>,<br>
> + HelpText<"Emit extra debug info to make sample profile more accurate.">;<br>
> +def fno_debug_info_for_profiling : Flag<["-"], "fno-debug-info-for-profiling"<wbr>>, Group<f_Group>,<br>
> + Flags<[DriverOption]>,<br>
> + HelpText<"Do not emit extra debug info for sample profiler.">;<br>
> def fprofile_instr_generate : Flag<["-"], "fprofile-instr-generate">,<br>
> Group<f_Group>, Flags<[CoreOption]>,<br>
> HelpText<"Generate instrumented code to collect execution counts into default.profraw file (overridden by '=' form of option or LLVM_PROFILE_FILE env var)">;<br>
><br>
> Modified: cfe/trunk/include/clang/<wbr>Frontend/CodeGenOptions.def<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.def?rev=292458&r1=292457&r2=292458&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/include/<wbr>clang/Frontend/CodeGenOptions.<wbr>def?rev=292458&r1=292457&r2=<wbr>292458&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- cfe/trunk/include/clang/<wbr>Frontend/CodeGenOptions.def (original)<br>
> +++ cfe/trunk/include/clang/<wbr>Frontend/CodeGenOptions.def Wed Jan 18 18:44:21 2017<br>
> @@ -258,6 +258,9 @@ CODEGENOPT(PIECopyRelocations, 1, 0)<br>
> /// paths that reach the end of a function without executing a required return.<br>
> CODEGENOPT(StrictReturn, 1, 1)<br>
><br>
> +/// Whether emit extra debug info for sample pgo profile collection.<br>
> +CODEGENOPT(<wbr>DebugInfoForProfiling, 1, 0)<br>
> +<br>
> #undef CODEGENOPT<br>
> #undef ENUM_CODEGENOPT<br>
> #undef VALUE_CODEGENOPT<br>
><br>
> Modified: cfe/trunk/lib/CodeGen/<wbr>BackendUtil.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=292458&r1=292457&r2=292458&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/CodeGen/<wbr>BackendUtil.cpp?rev=292458&r1=<wbr>292457&r2=292458&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- cfe/trunk/lib/CodeGen/<wbr>BackendUtil.cpp (original)<br>
> +++ cfe/trunk/lib/CodeGen/<wbr>BackendUtil.cpp Wed Jan 18 18:44:21 2017<br>
> @@ -573,6 +573,7 @@ void EmitAssemblyHelper::<wbr>CreateTargetMac<br>
> Options.DisableIntegratedAS = CodeGenOpts.<wbr>DisableIntegratedAS;<br>
> Options.CompressDebugSections = CodeGenOpts.<wbr>CompressDebugSections;<br>
> Options.RelaxELFRelocations = CodeGenOpts.<wbr>RelaxELFRelocations;<br>
> + Options.DebugInfoForProfiling = CodeGenOpts.<wbr>DebugInfoForProfiling;<br>
><br>
> // Set EABI version.<br>
> Options.EABIVersion = llvm::StringSwitch<llvm::EABI><wbr>(TargetOpts.EABIVersion)<br>
><br>
> Modified: cfe/trunk/lib/CodeGen/<wbr>CGDebugInfo.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=292458&r1=292457&r2=292458&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/CodeGen/<wbr>CGDebugInfo.cpp?rev=292458&r1=<wbr>292457&r2=292458&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- cfe/trunk/lib/CodeGen/<wbr>CGDebugInfo.cpp (original)<br>
> +++ cfe/trunk/lib/CodeGen/<wbr>CGDebugInfo.cpp Wed Jan 18 18:44:21 2017<br>
> @@ -2774,9 +2774,10 @@ void CGDebugInfo::<wbr>collectFunctionDeclPro<br>
> }<br>
> // No need to replicate the linkage name if it isn't different from the<br>
> // subprogram name, no need to have it at all unless coverage is enabled or<br>
> - // debug is set to more than just line tables.<br>
> + // debug is set to more than just line tables or extra debug info is needed.<br>
> if (LinkageName == Name || (!CGM.getCodeGenOpts().<wbr>EmitGcovArcs &&<br>
> !CGM.getCodeGenOpts().<wbr>EmitGcovNotes &&<br>
> + !CGM.getCodeGenOpts().<wbr>DebugInfoForProfiling &&<br>
> DebugKind <= codegenoptions::<wbr>DebugLineTablesOnly))<br>
> LinkageName = StringRef();<br>
><br>
><br>
> Modified: cfe/trunk/lib/Driver/Tools.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=292458&r1=292457&r2=292458&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/Driver/<wbr>Tools.cpp?rev=292458&r1=<wbr>292457&r2=292458&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- cfe/trunk/lib/Driver/Tools.cpp (original)<br>
> +++ cfe/trunk/lib/Driver/Tools.cpp Wed Jan 18 18:44:21 2017<br>
> @@ -5615,6 +5615,10 @@ void Clang::ConstructJob(<wbr>Compilation &C,<br>
> A->render(Args, CmdArgs);<br>
> }<br>
><br>
> + if (Args.hasFlag(options::OPT_<wbr>fdebug_info_for_profiling,<br>
> + options::OPT_fno_debug_info_<wbr>for_profiling, false))<br>
> + CmdArgs.push_back("-fdebug-<wbr>info-for-profiling");<br>
> +<br>
> // -fbuiltin is default unless -mkernel is used.<br>
> bool UseBuiltins =<br>
> Args.hasFlag(options::OPT_<wbr>fbuiltin, options::OPT_fno_builtin,<br>
><br>
> Modified: cfe/trunk/lib/Frontend/<wbr>CompilerInvocation.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=292458&r1=292457&r2=292458&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/<wbr>Frontend/CompilerInvocation.<wbr>cpp?rev=292458&r1=292457&r2=<wbr>292458&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- cfe/trunk/lib/Frontend/<wbr>CompilerInvocation.cpp (original)<br>
> +++ cfe/trunk/lib/Frontend/<wbr>CompilerInvocation.cpp Wed Jan 18 18:44:21 2017<br>
> @@ -544,6 +544,8 @@ static bool ParseCodeGenArgs(CodeGenOpti<br>
> Opts.DisableIntegratedAS = Args.hasArg(OPT_fno_<wbr>integrated_as);<br>
> Opts.Autolink = !Args.hasArg(OPT_fno_autolink)<wbr>;<br>
> Opts.SampleProfileFile = Args.getLastArgValue(OPT_<wbr>fprofile_sample_use_EQ);<br>
> + Opts.DebugInfoForProfiling = Args.hasFlag(<br>
> + OPT_fdebug_info_for_profiling, OPT_fno_debug_info_for_<wbr>profiling, false);<br>
><br>
> setPGOInstrumentor(Opts, Args, Diags);<br>
> Opts.InstrProfileOutput =<br>
><br>
> Modified: cfe/trunk/test/Driver/clang_f_<wbr>opts.c<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang_f_opts.c?rev=292458&r1=292457&r2=292458&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/Driver/<wbr>clang_f_opts.c?rev=292458&r1=<wbr>292457&r2=292458&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- cfe/trunk/test/Driver/clang_f_<wbr>opts.c (original)<br>
> +++ cfe/trunk/test/Driver/clang_f_<wbr>opts.c Wed Jan 18 18:44:21 2017<br>
> @@ -482,3 +482,8 @@<br>
> // RUN: %clang -### -S -fno-strict-return %s 2>&1 | FileCheck -check-prefix=CHECK-NO-STRICT-<wbr>RETURN %s<br>
> // CHECK-STRICT-RETURN-NOT: "-fno-strict-return"<br>
> // CHECK-NO-STRICT-RETURN: "-fno-strict-return"<br>
> +<br>
> +// RUN: %clang -### -S -fno-debug-info-for-profiling -fdebug-info-for-profiling %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-<wbr>DEBUG %s<br>
> +// RUN: %clang -### -S -fdebug-info-for-profiling -fno-debug-info-for-profiling %s 2>&1 | FileCheck -check-prefix=CHECK-NO-<wbr>PROFILE-DEBUG %s<br>
> +// CHECK-PROFILE-DEBUG: -fdebug-info-for-profiling<br>
> +// CHECK-NO-PROFILE-DEBUG-NOT: -fdebug-info-for-profiling<br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div></div>