Jan Hubicka <hubi...@ucw.cz> writes:

>> > 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?

Yeah, this doesn't smell right.  Martin, could you look at what's going on?

>
> 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?

Note that the prange implementation doesn't do anything extra we weren't
already doing with irange for pointers.  And the original code didn't
update ranges or value/mask pairs based on alignment, so you probably
still have to keep doing whatever alignment magic you were doing.

IIRC, alignment info was kept on the side by set_ptr_info_align() via
the code you're touching (ipa_compute_jump_functions_for_edge) and
ipcp_update_vr().  ??

Aldy

Reply via email to