> 
> IMO doing this in a  loop would have to handle all the above cases and would 
> make it hard to read. Also, we would have two level for now. Even if this 
> change in the future, this is not going to be too long.
> 
> Here is the revised patch,
> 
> Is this OK for mainline.

> gcc/ChangeLog:
> 
>       * auto-profile.cc (is_digit): New.
>       (get_original_name): Strip suffixes only for compiler generated
>       names tat happens after auto-profile.

> +  while (*(++ptr) != 0)
> +    if (!is_digit (*ptr))
  ISDIGIT or perhaps simply inlining the test *ptr < '0' || *ptr > '9'?
> +  if (only_digits)
> +    *last_dot = 0;
> +  char *next_dot = strrchr (ret, '.');
> +  /* if nested function such as foo.0, return foo.  */

foo.0 should be returned as foo.0

One can make multiple nested functions with the same name and they will
get various .digit suffixes.

How C++ lambdas are named?

> +  if (next_dot == NULL)
> +    return ret;
> +  /* Suffixes of clones that compiler generates after auto-profile.  */
> +  const char *suffixes[] = {"isra", "constprop", "lto_priv", "part", "cold"};

With part suffixes we also may want to merge specially, since the
entry_count of the split part does not correspond to entry_count of the
original function.

I wonder, does partitioned function work with the google tool?  I
remember it had limitations in this respect.

Reply via email to