<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 13, 2016 at 11:11 AM, Vedant Kumar <span dir="ltr"><<a href="mailto:vsk@apple.com" target="_blank">vsk@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
> On May 13, 2016, at 10:26 AM, Rong Xu via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br>
><br>
> Author: xur<br>
> Date: Fri May 13 12:26:06 2016<br>
> New Revision: 269437<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=269437&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=269437&view=rev</a><br>
> Log:<br>
> [PGO] Add flags to control IRPGO warnings.<br>
> Currently there is no reasonable way to control the warnings in the 'use' phase<br>
> of the IRPGO pass. This is problematic because the output can be somewhat<br>
> spammy. This patch adds some flags which allow us to optionally disable these<br>
> warnings. The current upstream behavior will remain the default.<br>
><br>
> Patch by Jake VanAdrighem (<a href="mailto:jvanadrighem@gmail.com">jvanadrighem@gmail.com</a>)<br>
><br>
> Differential Revision: <a href="http://reviews.llvm.org/D20195" rel="noreferrer" target="_blank">http://reviews.llvm.org/D20195</a><br>
><br>
> Modified:<br>
>    llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp<br>
><br>
> Modified: llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp?rev=269437&r1=269436&r2=269437&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp?rev=269437&r1=269436&r2=269437&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp Fri May 13 12:26:06 2016<br>
> @@ -111,6 +111,16 @@ static cl::opt<unsigned> MaxNumAnnotatio<br>
>     cl::desc("Max number of annotations for a single indirect "<br>
>              "call callsite"));<br>
><br>
> +// Command line option to enable/disable the warning about missing profile<br>
> +// information.<br>
> +static cl::opt<bool> NoPGOWarnMissing("no-pgo-warn-missing", cl::init(false),<br>
> +                                      cl::Hidden);<br>
> +<br>
> +// Command line option to enable/disable the warning about a hash mismatch in<br>
> +// the profile data.<br>
> +static cl::opt<bool> NoPGOWarnMismatch("no-pgo-warn-mismatch", cl::init(false),<br>
> +                                       cl::Hidden);<br>
> +<br>
> namespace {<br>
> class PGOInstrumentationGenLegacyPass : public ModulePass {<br>
> public:<br>
> @@ -575,11 +585,16 @@ bool PGOUseFunc::readCounters(IndexedIns<br>
>   ErrorOr<InstrProfRecord> Result =<br>
>       PGOReader->getInstrProfRecord(FuncInfo.FuncName, FuncInfo.FunctionHash);<br>
>   if (std::error_code EC = Result.getError()) {<br>
> -    if (EC == instrprof_error::unknown_function)<br>
> +    if (EC == instrprof_error::unknown_function) {<br>
>       NumOfPGOMissing++;<br>
> -    else if (EC == instrprof_error::hash_mismatch ||<br>
> -             EC == llvm::instrprof_error::malformed)<br>
> +      if (NoPGOWarnMissing)<br>
> +        return false;<br>
> +    } else if (EC == instrprof_error::hash_mismatch ||<br>
> +               EC == llvm::instrprof_error::malformed) {<br>
<br>
Now that I'm taking a closer look at this, this ^ seems weird.<br>
<br>
We can only see "malformed" here if InstrProfReaderIndex<HashTableImpl>::getRecords() finds `FuncName` in its table, but can't find any records for the corresponding function.<br></blockquote><div><br></div><div>You are right. The same error_code that emitted from reading the value profile records is not propagated back to getRecords().</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Is this really a recoverable error?<br></blockquote><div><br></div><div>So we just skip the pgo-use for this function. I don't see a problem here. Could you explain the concern?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
vedant<br>
<br>
>       NumOfPGOMismatch++;<br>
> +      if (NoPGOWarnMismatch)<br>
> +        return false;<br>
> +    }<br>
><br>
>     std::string Msg = EC.message() + std::string(" ") + F.getName().str();<br>
>     Ctx.diagnose(<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
<br>
</blockquote></div><br></div></div>