On Tue, Nov 3, 2026 at 5:18 PM Andrew MacLeod <[email protected]> wrote:
>
>
> pt_solution has a different lifecycle than the range, and with "null" out of 
> the pt_solution object duplicating
> one can be independent of the other.   This patch completes the segregation 
> and only combines them at the required places.
>
> Bootstraps on x86_64-pc-linux-gnu with no regressions.  OK?

OK.

> Andrew
>
>         * tree-ssanames.cc (duplicate_ssa_name_range_info): Do not copy
>         the pt_solution field.
>         (maybe_duplicate_ssa_info_at_copy): Copy both.
>         (duplicate_ssa_name_fn): Copy both.
> ---
>  gcc/tree-ssanames.cc | 21 +++++++++++----------
>  1 file changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/gcc/tree-ssanames.cc b/gcc/tree-ssanames.cc
> index a90fd60299e..18678e41fca 100644
> --- a/gcc/tree-ssanames.cc
> +++ b/gcc/tree-ssanames.cc
> @@ -925,7 +925,7 @@ copy_ssa_name_fn (struct function *fn, tree name, gimple 
> *stmt)
>    return new_name;
>  }
>
> -/* Give DEST its own copy of the points-to and alignment information of
> +/* Give DEST its own copy of the points-to information of
>     the SSA name SRC.  SRC may be NULL_TREE or carry no information, in
>     which case DEST is left alone.  */
>
> @@ -942,7 +942,7 @@ duplicate_ssa_name_ptr_info (tree dest, const 
> pt_solution* pt)
>    set_pt_solution (dest, copy);
>  }
>
> -/* Give DEST its own copy of the points-to and alignment information of
> +/* Give DEST its own copy of the points-to information of
>     the SSA name SRC.  SRC may be NULL_TREE or carry no information, in
>     which case DEST is left alone.  */
>
> @@ -956,7 +956,7 @@ duplicate_ssa_name_ptr_info (tree dest, tree src)
>      duplicate_ssa_name_ptr_info (dest, pt);
>  }
>
> -/* Copy any global range and aliasing information from SRC to NAME.  */
> +/* Copy any global range information from SRC to NAME.  */
>
>  void
>  duplicate_ssa_name_range_info (tree name, tree src)
> @@ -969,11 +969,6 @@ duplicate_ssa_name_range_info (tree name, tree src)
>    value_range src_range (TREE_TYPE (src));
>    range_info_get_range (src, src_range);
>    range_info_set_range (name, src_range);
> -
> -  /* For a pointer the aliasing info lives in the storage just created,
> -     so it has to be copied as part of the same operation.  */
> -  if (POINTER_TYPE_P (TREE_TYPE (src)))
> -    duplicate_ssa_name_ptr_info (name, src);
>  }
>
>  /* For a SSA copy DEST = SRC duplicate SSA info present on DEST to SRC
> @@ -989,7 +984,10 @@ maybe_duplicate_ssa_info_at_copy (tree dest, tree src)
>      return;
>
>    if (SSA_NAME_RANGE_INFO (dest) && !SSA_NAME_RANGE_INFO (src))
> -    duplicate_ssa_name_range_info (src, dest);
> +    {
> +      duplicate_ssa_name_range_info (src, dest);
> +      duplicate_ssa_name_ptr_info (src, dest);
> +    }
>  }
>
>
> @@ -1002,7 +1000,10 @@ duplicate_ssa_name_fn (struct function *fn, tree name, 
> gimple *stmt)
>    tree new_name = copy_ssa_name_fn (fn, name, stmt);
>
>    if (SSA_NAME_RANGE_INFO (name))
> -    duplicate_ssa_name_range_info (new_name, name);
> +    {
> +      duplicate_ssa_name_range_info (new_name, name);
> +      duplicate_ssa_name_ptr_info (new_name, name);
> +    }
>
>    return new_name;
>  }
> --
> 2.56.0
>

Reply via email to