On 5/17/23 16:30, Aldy Hernandez wrote:
This converts the lattice to store ranges in Value_Range instead of
value_range (*) to make it type agnostic, and adjust all users
accordingly.
I think it is a good example on converting from static ranges to more
general, type agnostic ones.
I've been careful to make sure Value_Range never ends up on GC, since
it contains an int_range_max and can expand on-demand onto the heap.
Longer term storage for ranges should be done with vrange_storage, as
per the previous patch ("Provide an API for ipa_vr").
(*) I do know the Value_Range naming versus value_range is quite
annoying, but it was a judgement call last release for the eventual
migration to having "value_range" be a type agnostic range object. We
will ultimately rename Value_Range to value_range.
I forgot to mention. This doesn't make IPA be type agnostic per se,
just the range usage throughout. The IPA code is still guarded by stuff
like:
if (!param_type
|| (!INTEGRAL_TYPE_P (param_type)
&& !POINTER_TYPE_P (param_type)))
return dest_lat->set_to_bottom (param_type);
It is up to the maintainers to adjust their passes, as I'm liable to
break everything in the process ;-).
The above should probably become:
if (!param_type || !Value_Range::supports_type_p (param_type))
...
This is the canonical way of querying whether a type is supported by
Value_Range, the ranger temporary that can handle each supported type,
and thus the ranger. This is documented here:
// To query what types ranger and the entire ecosystem can support,
// use Value_Range::supports_type_p(tree type). This is a static
// method available independently of any vrange object.
//
// To query what a given vrange variant can support, use:
// irange::supports_p ()
// frange::supports_p ()
// etc
However, with the changes I have posted so far, ranges throughout have a
much finer granularity and are no longer limited to the 2-sub-ranges in
a value_range. If you look at IPA dumps now, you'll see the ranges are
much more refined and are streamed for LTO accordingly. This is an
improvement in and of itself.
Aldy