Aliasing: look through pointer's def stmt

Richard Biener richard.guenther@gmail.com
Mon Nov 4 20:26:00 GMT 2013


Marc Glisse <marc.glisse@inria.fr> wrote:
>On Mon, 4 Nov 2013, Richard Biener wrote:
>
>> Well, host_integer_p (, 0) looks correct to me.  But ...
>
>Ok, I'll put it back.
>
>>> Index: gcc/tree-ssa-alias.h
>>> ===================================================================
>>> --- gcc/tree-ssa-alias.h        (revision 204267)
>>> +++ gcc/tree-ssa-alias.h        (working copy)
>>> @@ -139,30 +139,30 @@ extern void pt_solution_set_var (struct
>>>
>>>  extern void dump_pta_stats (FILE *);
>>>
>>>  extern GTY(()) struct pt_solution ipa_escaped_pt;
>>>
>>>  /* Return true, if the two ranges [POS1, SIZE1] and [POS2, SIZE2]
>>>     overlap.  SIZE1 and/or SIZE2 can be (unsigned)-1 in which case
>the
>>>     range is open-ended.  Otherwise return false.  */
>>>
>>>  static inline bool
>>> -ranges_overlap_p (unsigned HOST_WIDE_INT pos1,
>>> -                 unsigned HOST_WIDE_INT size1,
>>> -                 unsigned HOST_WIDE_INT pos2,
>>> -                 unsigned HOST_WIDE_INT size2)
>>> +ranges_overlap_p (HOST_WIDE_INT pos1,
>>> +                 HOST_WIDE_INT size1,
>>> +                 HOST_WIDE_INT pos2,
>>> +                 HOST_WIDE_INT size2)
>>
>> I think size[12] should still be unsigned (we don't allow negative
>> sizes but only the special value -1U which we special-case only to
>> avoid pos + size to wrap)
>
>But all we do with size[12] is compare it to -1 and perform arithmetic 
>with pos[12]. At least for the second one, we need to cast size to a 
>signed type so the comparisons make sense (unless we decide to use a 
>double_int there). So I thought I would do the cast in the argument. 
>Otherwise, I'll start the function with:
>HOST_WIDE_INT ssize1 = (HOST_WIDE_INT)size1;
>and replace size1 with ssize1 through the function.
>
>Is the reason of keeping size[12] unsigned for documentation? Or am I 
>missing a reason why I may be breaking things?

It is mostly documentation indeed.

Richard.



More information about the Gcc-patches mailing list