This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [GOOGLE, AUTOFDO] Assign different discriminators to calls with the same lineno


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]