It's already pushed but FWIW looks straightforward and ok to me.  Just one
question out of curiosity...

On Tue 2026-06-30 14:41:24, Richard Biener wrote:
> The following records whether a points-to solution contains any
> local automatic variables, not including parameters or result storage.
> 
> Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.
> 
> This was requested by HJ (or rather suggested by me).
> 
> Richard.
> 
>       * tree-ssa-alias.h (pt_solution::vars_contains_auto): New.
>       (ptr_deref_may_alias_auto_p): Declare.
>       (pt_solution_includes_auto): Likewise.
>       * tree-ssa-structalias.cc (set_uids_in_ptset): Record auto
>       variables.
>       (pt_solution_includes_auto): New function.
>       (ipa_escaped_pt): Adjust.
>       * tree-ssa-alias.cc (ptr_deref_may_alias_auto_p): New function.
> ---
>  gcc/tree-ssa-alias.cc       | 24 ++++++++++++++++++++++++
>  gcc/tree-ssa-alias.h        |  4 ++++
>  gcc/tree-ssa-structalias.cc | 30 +++++++++++++++++++++++++++++-
>  3 files changed, 57 insertions(+), 1 deletion(-)
> 
> diff --git a/gcc/tree-ssa-alias.cc b/gcc/tree-ssa-alias.cc
> index 467ef1c215f..1d10f6dbd97 100644
> --- a/gcc/tree-ssa-alias.cc
> +++ b/gcc/tree-ssa-alias.cc
> @@ -238,6 +238,30 @@ ptr_deref_may_alias_global_p (tree ptr, bool 
> escaped_local_p)
>    return pt_solution_includes_global (&pi->pt, escaped_local_p);
>  }
>  
> +/* Return true, if dereferencing PTR may alias with a local automatic
> +   variable.  */
> +
> +bool
> +ptr_deref_may_alias_auto_p (tree ptr)
> +{
> +  struct ptr_info_def *pi;
> +
> +  /* If we end up with a pointer constant here that may point
> +     to local stack memory.  */
> +  if (TREE_CODE (ptr) != SSA_NAME)
> +    return true;

... In this context ptr can only be an SSA name or a constant?  Cannot it be
some global variable?  Or am I reading the comment wrong?

Cheers,
Filip

Reply via email to