[PATCH] Always emit function declaration when generating profile instrumentation
Reid Kleckner
rnk at google.com
Wed May 28 14:15:09 PDT 2014
On Wed, May 28, 2014 at 1:56 PM, Duncan P. N. Exon Smith <
dexonsmith at apple.com> wrote:
> > On 2014-May-28, at 13:43, Reid Kleckner <rnk at google.com> wrote:
> >
> > On Wed, May 28, 2014 at 1:06 PM, Alex L <arphaman at gmail.com> wrote:
> > Sure, We need to call CodeGenPGO::assignRegionCounters for all functions
> > because we want to emit counter variables for all functions in a
> translation unit, even if they aren't used.
> >
> > Why do you want to emit counter variables for unused functions?
>
> Coverage. There's a difference between "no data" (this function wasn't
> instrumented) and "never called" (counter is zero). This patch moves
> unused
> functions from the former category to the latter.
>
Why do you need profiling data on inline functions that were never called?
You will only need profiling data if someone adds a call to the inline
function, in which case the program changed, and the zeroed out counters
won't be very helpful. If some TU needed them, it will emit them.
Also, CodeGenerator::HandleInlineMethodDefinition() would be a better place
for this code. We recently added it for dllexport, which has basically the
semantics you want. If this ends up being the direction we want, we
probably want to merge support for -femit-all-decls, pgo, and dllexport in
the same place to control the linkage and MustBeEmitted-ness of inline
functions.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140528/975ea463/attachment.html>
More information about the cfe-commits
mailing list