This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [GOOGLE, AUTOFDO] Assign different discriminators to calls with the same lineno
- From: Wei Mi <wmi at google dot com>
- To: Cary Coutant <ccoutant at google dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, David Li <davidxl at google dot com>, Dehao Chen <dehao at google dot com>
- Date: Thu, 28 Aug 2014 17:11:41 -0700
- Subject: Re: [GOOGLE, AUTOFDO] Assign different discriminators to calls with the same lineno
- Authentication-results: sourceware.org; auth=none
- References: <CA+4CFy6AUJ6UL_RjYBhjWjQA+GBxoac4yh44=UkKBvJAtAekFA at mail dot gmail dot com> <CAHACq4rjjf9yWAe1qtyqCpaoUfu8ESQ=K9CvO=YtXo3Xo4VGJw at mail dot gmail dot com> <CA+4CFy6ZW2__5aR86Uo9gV+fbgNQb+_P2dPXeEy1iCTVn5kmUA at mail dot gmail dot com> <CA+4CFy5qHHuXhWhFjTzQUmvDs50QiQCitjsbhTCO5V-cha6Qnw at mail dot gmail dot com>
Hi Cary,
Is the new patch ok for google-4_9?
Thanks,
Wei.
On Sun, Aug 24, 2014 at 8:53 PM, Wei Mi <wmi@google.com> wrote:
> To avoid the unused new discriminator value, I added a map
> "found_call_this_line" to track whether a call is the first call in a
> source line seen when assigning discriminators. For the first call in
> a source line, its discriminator is 0. For the following calls in the
> same source line, a new discriminator will be used everytime. The new
> patch is attached. Internal perf test and regression test are ok. Is
> it ok for google-4_9?
>
> Thanks,
> Wei.
>
>
>
> On Thu, Aug 7, 2014 at 2:10 PM, Wei Mi <wmi@google.com> wrote:
>> Yes, that is intentional. It is to avoid assiging a discriminator for
>> the first call in the group of calls with the same source lineno.
>> Starting from the second call in the group, it will get a different
>> discriminator with previous call in the same group.
>>
>> Thanks,
>> Wei.
>>
>> On Thu, Aug 7, 2014 at 12:17 PM, Cary Coutant <ccoutant@google.com> wrote:
>>>> static int
>>>> -next_discriminator_for_locus (location_t locus)
>>>> +increase_discriminator_for_locus (location_t locus, bool return_next)
>>>> {
>>>> struct locus_discrim_map item;
>>>> struct locus_discrim_map **slot;
>>>> @@ -934,8 +936,10 @@ next_discriminator_for_locus (location_t
>>>> (*slot)->locus = locus;
>>>> (*slot)->discriminator = 0;
>>>> }
>>>> +
>>>> (*slot)->discriminator++;
>>>> - return (*slot)->discriminator;
>>>> + return return_next ? (*slot)->discriminator
>>>> + : (*slot)->discriminator - 1;
>>>> }
>>>
>>> Won't this have the effect of sometimes incrementing the next
>>> available discriminator without actually using the new value? That is,
>>> if you call it once with return_next == false, and then with
>>> return_next == true.
>>>
>>> -cary