expr_not_equal_to: use value_range API

Aldy Hernandez aldyh@redhat.com
Thu Nov 8 14:27:00 GMT 2018



On 11/8/18 9:21 AM, Richard Biener wrote:
> On Thu, Nov 8, 2018 at 1:09 PM Aldy Hernandez <aldyh@redhat.com> wrote:
>>
>> All this nonsense:
>>
>> -      rtype = get_range_info (t, &min, &max);
>> -      if (rtype == VR_RANGE)
>> -       {
>> -         if (wi::lt_p (max, w, TYPE_SIGN (TREE_TYPE (t))))
>> -           return true;
>> -         if (wi::lt_p (w, min, TYPE_SIGN (TREE_TYPE (t))))
>> -           return true;
>> -       }
>> -      else if (rtype == VR_ANTI_RANGE
>> -              && wi::le_p (min, w, TYPE_SIGN (TREE_TYPE (t)))
>> -              && wi::le_p (w, max, TYPE_SIGN (TREE_TYPE (t))))
>>
>> Replaced by an API like Kutulu intended.
>>
>> +      get_range_info (t, vr);
>> +      if (!vr.may_contain_p (wide_int_to_tree (TREE_TYPE (t), w)))
>>
>> Ain't it grand?
> 
> Well.  The not-so-grand thing is that you possibly ggc-allocate
> three INTEGER_CST nodes here.

Hmmm... I'd really prefer to use a simple API call, instead of having to 
twiddle with the extremes manually.  Ideally no one should be looking 
inside of a value_range.

Do recommend another way of implementing may_contain_p ?

Aldy

> 
> So, no ...?
> 
> Shouldn't this instead use wide-int-range.h?  (yeah, there's
> the class-ification still missing there)
> 
> Richard.
> 
>> OK for trunk, depending on get_range_info changes of course?
>>
>> Aldy



More information about the Gcc-patches mailing list