From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 89428 invoked by alias); 2 Sep 2015 20:46:03 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 89414 invoked by uid 89); 2 Sep 2015 20:46:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail-ig0-f172.google.com Received: from mail-ig0-f172.google.com (HELO mail-ig0-f172.google.com) (209.85.213.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 02 Sep 2015 20:46:00 +0000 Received: by igbkq10 with SMTP id kq10so34403295igb.0 for ; Wed, 02 Sep 2015 13:45:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=+MyMt13vpgjMtZbr3q6kYBq9lNVhbvkSAHOx7mYbhwg=; b=IIipV4GpJWUQyjGOgQUA8sBKerDJMJ/ChgN+3aYN3l1OUmocmGr3Mjmo1tiC56Pi9Z QgZWHL6+0xXj0nh13Uf6Yv2II40Vl+popa72G5aCRKMAnkMflfi2QSuZzDum4Y1gbVdg EI5a+s07kpqksS+YoPrsbl3Q/plYLU3GIV86/PwMsza6L5QJ84SmdhbzgfiUfcwbYXyP FYZWJi3teUsBqsEAAUrxGohyQRFjirztxkvbcGj9CN17eT4fkjIT+6opeOowaPrpcNZE PCIqzimF1XlJwSwTv8LxJKplIzQuiGxw6p5knV2Ap9bvooH6pTYpluaUT7fucXzmQtZx HyrQ== X-Gm-Message-State: ALoCoQkSjQP6VpMBAR8DWMqUx5JqcnZXFBXnu00F/U/zGbv7v4lDlJnUEn+12piFSw/H7MX90ylt MIME-Version: 1.0 X-Received: by 10.50.80.13 with SMTP id n13mr6464402igx.6.1441226758594; Wed, 02 Sep 2015 13:45:58 -0700 (PDT) Received: by 10.64.96.6 with HTTP; Wed, 2 Sep 2015 13:45:58 -0700 (PDT) In-Reply-To: References: Date: Wed, 02 Sep 2015 20:51:00 -0000 Message-ID: Subject: Re: Patch GCC for profile-func-internal-id=0 coverage-callback=1 From: Xinliang David Li To: Rong Xu Cc: Matt Deeds , GCC Patches , Jan Hubicka Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-09/txt/msg00189.txt.bz2 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 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 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, > >