> Am 13.08.2026 um 19:51 schrieb Aldy Hernandez <[email protected]>:
> 
> The ranger has refused to look at SSA names occurring in abnormal
> PHIs since r12-4443-g93ac832f1846e4, but there is no reason range
> analysis cannot handle them.  The abnormal marker is a constraint on
> transformations, not on analysis: no copy can be inserted on an
> abnormal edge, so the incoming value and the PHI result must
> coalesce.  Analysis learns nothing from conditions on abnormal edges
> (there are none), but PHI and copy semantics hold like anywhere else.
> 
> Tested on ppc64le Linux.
> 
> OK?

Ok for 1/2

Richard 

> gcc/ChangeLog:
> 
>    * gimple-range-fold.h (gimple_range_ssa_p): Remove the
>    SSA_NAME_OCCURS_IN_ABNORMAL_PHI check.
>    * gimple-range-path.cc (path_range_query::ssa_range_in_phi):
>    Assert the incoming path edge is not abnormal.
> ---
> gcc/gimple-range-fold.h  | 1 -
> gcc/gimple-range-path.cc | 4 ++++
> 2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/gcc/gimple-range-fold.h b/gcc/gimple-range-fold.h
> index b11c179d173..bf4310847e4 100644
> --- a/gcc/gimple-range-fold.h
> +++ b/gcc/gimple-range-fold.h
> @@ -90,7 +90,6 @@ gimple_range_ssa_p (tree exp)
> {
>   if (exp && TREE_CODE (exp) == SSA_NAME &&
>       !SSA_NAME_IS_VIRTUAL_OPERAND (exp) &&
> -      !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (exp) &&
>       value_range::supports_type_p (TREE_TYPE (exp)))
>     return exp;
>   return NULL_TREE;
> diff --git a/gcc/gimple-range-path.cc b/gcc/gimple-range-path.cc
> index 8a89da3dda3..467e321b8de 100644
> --- a/gcc/gimple-range-path.cc
> +++ b/gcc/gimple-range-path.cc
> @@ -256,6 +256,10 @@ path_range_query::ssa_range_in_phi (vrange &r, gphi *phi)
>   basic_block bb = gimple_bb (phi);
>   basic_block prev = prev_bb ();
>   edge e_in = find_edge (prev, bb);
> +  // The incoming edge the path supplies is never abnormal, so the
> +  // argument on it is a valid value for the PHI result even when the
> +  // result occurs in an abnormal PHI.
> +  gcc_checking_assert (!(e_in->flags & EDGE_ABNORMAL));
>   tree arg = PHI_ARG_DEF_FROM_EDGE (phi, e_in);
>   // Avoid using the cache for ARGs defined in this block, as
>   // that could create an ordering problem.
> --
> 2.47.3
> 

Reply via email to