2014-08-29  Wei Mi  <w...@google.com>

        * tree-cfg.c (struct locus_discrim_map): New field needs_increment.
        (next_discriminator_for_locus): Increase discriminator only when
        return_next or needs_increment are true.
        (assign_discriminator): Add an actual for next_discriminator_for_locus.
        (assign_discriminators): Assign different discriminators for calls
        belonging to the same source line.

OK for google/gcc-4_9 branch. Thanks!

-cary

On Fri, Aug 29, 2014 at 1:59 PM, Wei Mi <w...@google.com> wrote:
>> On Fri, Aug 29, 2014 at 10:11 AM, Cary Coutant <ccout...@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?
>>>
>>> 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
>
> Here is the new patch (attached). Regression test passes. Cary, is it ok?
>
> Thanks,
> Wei.

Reply via email to