https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113907

--- Comment #28 from rguenther at suse dot de <rguenther at suse dot de> ---
On Wed, 14 Feb 2024, jakub at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113907
> 
> --- Comment #27 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> So:
> --- gcc/ipa-icf.cc.jj   2024-02-10 11:25:09.645478952 +0100
> +++ gcc/ipa-icf.cc      2024-02-14 10:44:27.906216458 +0100
> @@ -1244,6 +1244,29 @@ sem_function::merge (sem_item *alias_ite
>    else
>      create_alias = true;
> 
> +  unsigned i;
> +  tree name;
> +  FOR_EACH_SSA_NAME (i, name, original->get_fun ())
> +    {
> +      /* We need to either merge or reset SSA_NAME_*_INFO.
> +        For merging we don't preserve the mapping between
> +        original and alias SSA_NAMEs from successful equals
> +        calls.  */
> +      if (POINTER_TYPE_P (TREE_TYPE (name)))
> +        {
> +         if (SSA_NAME_PTR_INFO (name))
> +           {
> +             gcc_assert (!flag_wpa);
> +             SSA_NAME_PTR_INFO (name) = NULL;
> +           }
> +        }
> +      else if (SSA_NAME_RANGE_INFO (name))
> +       {
> +         gcc_assert (!flag_wpa);
> +         SSA_NAME_RANGE_INFO (name) = NULL;
> +       }
> +    }
> +
>    if (redirect_callers)
>      {
>        int nredirected = redirect_all_callers (alias, local_original);
> then?

Yeah, though can't we do this in the caller and thus only once for the
target when we merge more than 2 nodes?

  For the merging, I guess we'd need to move one of the 2 vec<int> vectors
> from m_checker to the sem_function instead of throwing it away in
> sem_function::equals
> if returning true.

It might require quite some amount of memory though when N is big,
I'm not sure it's worth it?

Reply via email to