[PATCH] Be careful about comdat boundary in ICF (PR ipa/82352).

Jan Hubicka hubicka@ucw.cz
Wed Jan 3 13:24:00 GMT 2018


> Hi.
> 
> This patch is follow-up of r246848. This time ICF creates an edge between 2 functions,
> where one is inside a comdat group and second is not. I've got patch that is conservative
> about the comdat groups (in_same_comdat_group_p).
> 
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
> 
> Ready to be installed?
> Martin
> 
> gcc/ChangeLog:
> 
> 2018-01-03  Martin Liska  <mliska@suse.cz>
> 
> 	PR ipa/82352
> 	* ipa-icf.c (sem_function::merge): Do not cross comdat boundary.
> 
> gcc/testsuite/ChangeLog:
> 
> 2018-01-03  Martin Liska  <mliska@suse.cz>
> 
> 	PR ipa/82352
> 	* g++.dg/ipa/pr82352.C: New test.
> ---
>  gcc/ipa-icf.c                      |  9 ++++
>  gcc/testsuite/g++.dg/ipa/pr82352.C | 93 ++++++++++++++++++++++++++++++++++++++
>  2 files changed, 102 insertions(+)
>  create mode 100644 gcc/testsuite/g++.dg/ipa/pr82352.C
> 
> 

> diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
> index a8d3b800318..a56c7306201 100644
> --- a/gcc/ipa-icf.c
> +++ b/gcc/ipa-icf.c
> @@ -1113,6 +1113,15 @@ sem_function::merge (sem_item *alias_item)
>        return false;
>      }
>  
> +  if (!original->in_same_comdat_group_p (alias))
> +    {
> +      if (dump_file)
> +	fprintf (dump_file, "Not unifying; alias cannot be created; "
> +		 "across comdat group boundary\n\n");
> +
> +      return false;
> +    }

Wasn't we supposed to do the wrapper in this case?

Honza



More information about the Gcc-patches mailing list