On Thu, Nov 8, 2018 at 3:27 PM Aldy Hernandez <al...@redhat.com> wrote: > > > > On 11/8/18 9:21 AM, Richard Biener wrote: > > On Thu, Nov 8, 2018 at 1:09 PM Aldy Hernandez <al...@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 ?
I think many places dealing with get_range_info () should instead work on the (to be created...) 1:1 copy of value_range ontop of wide-int-range instead. So - can you add a wide_int_range class to wide-int-range.h that implements the same (but with wide-ints rather than trees obviously) API as value-range? IIRC you once had sth like that to simpify arg passing to the workers but otherwise without much functionality? Richard. > 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