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

Cary Coutant ccoutant@google.com
Thu Aug 7 19:17:00 GMT 2014


>  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



More information about the Gcc-patches mailing list