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: Cary Coutant <ccoutant at google dot com>
- To: Wei Mi <wmi 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: Fri, 29 Aug 2014 10:11:06 -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>
> 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?
This seems overly complex to me. I'd think all you need to do is add a
bit to locus_discrim_map (stealing a bit from discriminator ought to
be fine) that indicates whether the next call should increment the
discriminator or not. Something like this:
increase_discriminator_for_locus (location_t locus, bool return_next)
{
...
if (return_next || (*slot)->needs_increment)
{
(*slot)->discriminator++;
(*slot)->needs_increment = false;
}
else
(*slot)->needs_increment = true;
return (*slot)->discriminator;
}
-cary