> > 2024-11-01  Martin Jambor  <mjam...@suse.cz>
> >
> >         * ipa-prop.cc (ipa_compute_jump_functions_for_edge): When creating
> >         value-range jump functions from pointer type constant zero, do so
> >         as if it was not a pointer.
> > ---
> >  gcc/ipa-prop.cc | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/gcc/ipa-prop.cc b/gcc/ipa-prop.cc
> > index 9bd2e4bc60c..012f8a32386 100644
> > --- a/gcc/ipa-prop.cc
> > +++ b/gcc/ipa-prop.cc
> > @@ -2368,7 +2368,8 @@ ipa_compute_jump_functions_for_edge (struct 
> > ipa_func_body_info *fbi,
> >         }
> >
> >        value_range vr (TREE_TYPE (arg));
> > -      if (POINTER_TYPE_P (TREE_TYPE (arg)))
> > +      if (POINTER_TYPE_P (TREE_TYPE (arg))
> > +         && !zerop (arg))
> 
> integer_zerop (arg) - I also think this deserves a comment.

Comment would indeed be nice.  It is not clear to me why special
handling is needed here and ranger does not give the same or better
value range than one we compute based on alignment+offset and non-zero
ness?

The code was needed since we did not have value ranges for pointer typed
SSA names, but do we still need to special case them these days?

Honza
> 
> Richard.
> 
> >         {
> >           bool addr_nonzero = false;
> >           bool strict_overflow = false;
> > --
> > 2.47.0
> >

Reply via email to