[llvm] r269437 - [PGO] Add flags to control IRPGO warnings.

Rong Xu via llvm-commits llvm-commits at lists.llvm.org
Fri May 13 11:47:19 PDT 2016


On Fri, May 13, 2016 at 11:11 AM, Vedant Kumar <vsk at apple.com> wrote:

>
> > On May 13, 2016, at 10:26 AM, Rong Xu via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
> >
> > Author: xur
> > Date: Fri May 13 12:26:06 2016
> > New Revision: 269437
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=269437&view=rev
> > Log:
> > [PGO] Add flags to control IRPGO warnings.
> > Currently there is no reasonable way to control the warnings in the
> 'use' phase
> > of the IRPGO pass. This is problematic because the output can be somewhat
> > spammy. This patch adds some flags which allow us to optionally disable
> these
> > warnings. The current upstream behavior will remain the default.
> >
> > Patch by Jake VanAdrighem (jvanadrighem at gmail.com)
> >
> > Differential Revision: http://reviews.llvm.org/D20195
> >
> > Modified:
> >    llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
> >
> > Modified:
> llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp?rev=269437&r1=269436&r2=269437&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
> (original)
> > +++ llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp Fri
> May 13 12:26:06 2016
> > @@ -111,6 +111,16 @@ static cl::opt<unsigned> MaxNumAnnotatio
> >     cl::desc("Max number of annotations for a single indirect "
> >              "call callsite"));
> >
> > +// Command line option to enable/disable the warning about missing
> profile
> > +// information.
> > +static cl::opt<bool> NoPGOWarnMissing("no-pgo-warn-missing",
> cl::init(false),
> > +                                      cl::Hidden);
> > +
> > +// Command line option to enable/disable the warning about a hash
> mismatch in
> > +// the profile data.
> > +static cl::opt<bool> NoPGOWarnMismatch("no-pgo-warn-mismatch",
> cl::init(false),
> > +                                       cl::Hidden);
> > +
> > namespace {
> > class PGOInstrumentationGenLegacyPass : public ModulePass {
> > public:
> > @@ -575,11 +585,16 @@ bool PGOUseFunc::readCounters(IndexedIns
> >   ErrorOr<InstrProfRecord> Result =
> >       PGOReader->getInstrProfRecord(FuncInfo.FuncName,
> FuncInfo.FunctionHash);
> >   if (std::error_code EC = Result.getError()) {
> > -    if (EC == instrprof_error::unknown_function)
> > +    if (EC == instrprof_error::unknown_function) {
> >       NumOfPGOMissing++;
> > -    else if (EC == instrprof_error::hash_mismatch ||
> > -             EC == llvm::instrprof_error::malformed)
> > +      if (NoPGOWarnMissing)
> > +        return false;
> > +    } else if (EC == instrprof_error::hash_mismatch ||
> > +               EC == llvm::instrprof_error::malformed) {
>
> Now that I'm taking a closer look at this, this ^ seems weird.
>
> 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.
>

You are right. The same error_code that emitted from reading the value
profile records is not propagated back to getRecords().


> Is this really a recoverable error?
>

So we just skip the pgo-use for this function. I don't see a problem here.
Could you explain the concern?


>
> vedant
>
> >       NumOfPGOMismatch++;
> > +      if (NoPGOWarnMismatch)
> > +        return false;
> > +    }
> >
> >     std::string Msg = EC.message() + std::string(" ") +
> F.getName().str();
> >     Ctx.diagnose(
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160513/aeb0b3b3/attachment.html>


More information about the llvm-commits mailing list