[PATCH] D36025: Do not want to use BFI to get profile count for sample pgo

Dehao Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 28 16:52:36 PDT 2017

danielcdh added a comment.

In https://reviews.llvm.org/D36025#824921, @eraman wrote:

> In https://reviews.llvm.org/D36025#824907, @danielcdh wrote:
> > In https://reviews.llvm.org/D36025#824892, @eraman wrote:
> >
> > > If the profile count based on BFI is completely reliable that you are discarding it, then shouldn't BFI->getProfileCount also return 0 for sampled profiling? I think this can end up in surprising behavior.
> >
> >
> > We only want to do this on callsites, as we still rely on BFI to get other block frequencies.
> So, either the BFI based count is usable in sample PGO or not. If it is the latter, I think it should not be used at all. If it is usable (but not very accurate), then there is no harm in using in call.

It's usable. But inaccurate.

> Do we use the profile count of a non-call instruction anywhere for sample PGO? If we don't, may be assert in BFI->getProfileCount when we use sample PGO?

Yes, there is already an assertion in ProfileSummaryInfo::getProfileCount to ensure Inst is a call/invoke instruction :)

> Or alternatively, annotate all call instructions so that you can assert that every call has a metadata (which could be 0)?

In sample PGO, if the call count is 0, we don't set prof metadata to save space, as most of the call instructions will have 0 count.


More information about the llvm-commits mailing list