public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Xinliang David Li <davidxl@google.com>
To: Rong Xu <xur@google.com>
Cc: Matt Deeds <mattdeeds@google.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>,
		Jan Hubicka <hubicka@ucw.cz>
Subject: Re: Patch GCC for profile-func-internal-id=0 coverage-callback=1
Date: Wed, 02 Sep 2015 20:51:00 -0000	[thread overview]
Message-ID: <CAAkRFZJpuz3Tbt_TkE9JOVeqwcYmDH2oRoQQV44NyaEjAxryhQ@mail.gmail.com> (raw)
In-Reply-To: <CAF1bQ=S2kiR==OZSsDK3e7UWetT2FEeXPSmFv4P1EO_2GPznaQ@mail.gmail.com>

Sorry for the wrong advice. I thought the feature was in trunk. Rong,
can you submit the callback support to trunk?

David


On Wed, Sep 2, 2015 at 1:41 PM, Rong Xu <xur@google.com> wrote:
> Matt,
>
> It seems this patch is for google branch, rather the trunk. The code for
> coverage callback function is not in trunk.
>
> It's ok to submit to google/gcc-4_9 branch.
>
> Thanks,
>
> -Rong
>
> On Wed, Sep 2, 2015 at 10:01 AM, Matt Deeds <mattdeeds@google.com> wrote:
>>
>> Hello, Honza.  David Li said you might be able to help me get this
>> patch into GCC trunk.  I sent mail for this on August 27, but didn't
>> get a reply.  It's a small change to make these two options work
>> together:
>>
>> profile-func-internal-id=0 coverage-callback=1
>>
>> Let me know what I can do to get this submitted.
>>
>> This patch is for svn://gcc.gnu.org/svn/gcc/branches/google/gcc-4_9.  I
>> add
>> support for the profile_func_internal-id in the instrumentation generated
>> for
>> __coverage_callback.
>>
>> Add support for the profile-func-internal-id parameter to the coverage
>> callback.
>> Without this change, the function identifier passed to __coverage_callback
>> (enabled with param=coverage-callback=1) does not match the values emitted
>> in
>> the .gcno file.  Because the function profile_id is typically more unique
>> (typically 32 bits) than the function internal id (typically 16 bits), it
>> can be
>> desirable to have the profile_id used to identify a function as opposed to
>> the
>> function internal id.
>>
>> I've instrumented a large binary creating over 500 .gcno files and
>> confirmed
>> that function IDs in these .gcno files match the IDs in
>> __coverage_callback.  In
>> my example, there were typically about one to four functions sharing the
>> same
>> internal function ID.  There were no collisions using profile_id.
>>
>>
>> Index: gcc/tree-profile.c
>> ===================================================================
>> --- gcc/tree-profile.c (revision 226647)
>> +++ gcc/tree-profile.c (working copy)
>> @@ -864,8 +864,20 @@ gimple_gen_edge_profiler (int edgeno, edge e)
>>      {
>>        gimple call;
>>        tree tree_edgeno = build_int_cst (gcov_type_node, edgeno);
>> -      tree tree_uid = build_int_cst (gcov_type_node,
>> +
>> +      tree tree_uid;
>> +      if (PARAM_VALUE (PARAM_PROFILE_FUNC_INTERNAL_ID))
>> +        {
>> +          tree_uid  = build_int_cst (gcov_type_node,
>>                                       current_function_funcdef_no);
>> +        }
>> +      else
>> +        {
>> +          gcc_assert (coverage_node_map_initialized_p ());
>> +
>> +          tree_uid = build_int_cst
>> +      (gcov_type_node, cgraph_get_node
>> (current_function_decl)->profile_id);
>> +        }
>>        tree callback_fn_type
>>                = build_function_type_list (void_type_node,
>>                                            gcov_type_node,
>
>

      parent reply	other threads:[~2015-09-02 20:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-02 17:01 Matt Deeds
     [not found] ` <CAF1bQ=S2kiR==OZSsDK3e7UWetT2FEeXPSmFv4P1EO_2GPznaQ@mail.gmail.com>
2015-09-02 20:51   ` Xinliang David Li [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAkRFZJpuz3Tbt_TkE9JOVeqwcYmDH2oRoQQV44NyaEjAxryhQ@mail.gmail.com \
    --to=davidxl@google.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=mattdeeds@google.com \
    --cc=xur@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).