This patchset implements prange, a range class for pointers.

This is meant to be a drop-in replacement for pointer ranges, so we
can pull them out of irange, simplifying both irange and prange in the
process.  Initially we have two integer endpoints and the usual
value/mask bitmasks as this is how irange currently implements them,
but the end goal is to provide points-to info to replace the hacky
pointer equivalency we do in class pointer_equiv_analyzer.

I have split up the patchset into tiny pieces to make it easier to
track any problems.  I have also disabled it by default, choosing to
wait a few days until the dust has settled.  In a few days I will
throw the switch enabling pranges, which will make it invalid for
irange's to hold pointers.  Once pranges are enabled, I will do some
minor cleanups like removing pointer support from range-ops, etc.

The performance of prange is a wash for VRP and a 7% improvement for
IPA-cp.  This is taking into account the unrelated 2% hit we take due to
inlining as discussed here:

https://gcc.gnu.org/pipermail/gcc/2024-May/243898.html

Also, as part of this work, we improved VRP by 6% (on top of the above
numbers):

https://gcc.gnu.org/pipermail/gcc-patches/2024-May/650320.html

So things are looking relatively good.

The memory usage will also decrease, both by the 14% reduction in
Value_Range, and by prange's being smaller than say int_range_max or
int_range<3>.

Tested and benchmarked on x86-64 Linux.

Aldy Hernandez (23):
  Minimal prange class showing inlining degradation to VRP.
  Implement basic prange class.
  Add streaming support for prange.
  Add storage support for prange.
  Add hashing support for prange.
  Add prange implementation for get_legacy_range.
  Implement range-op dispatch for prange.
  Implement operator_identity for prange.
  Implement operator_cst for prange.
  Implement operator_cast for prange.
  Implement operator_min and operator_max for prange.
  Implement operator_addr_expr for prange.
  Implement pointer_plus_operator for prange.
  Implement operator_pointer_diff for prange.
  Implement operator_bitwise_and for prange.
  Implement operator_bitwise_or for prange.
  Implement operator_not_equal for prange.
  Implement operator_equal for prange.
  Implement operator_lt for prange.
  Implement operator_le for prange.
  Implement operator_gt for prange.
  Implement operator_ge for prange....
  Add prange entries in gimple-range-op.cc.

 gcc/data-streamer-in.cc         |   12 +
 gcc/data-streamer-out.cc        |   10 +
 gcc/gimple-range-op.cc          |   36 +
 gcc/range-op-mixed.h            |  156 ++++
 gcc/range-op-ptr.cc             | 1545 +++++++++++++++++++++++++++++++
 gcc/range-op.cc                 |  124 +++
 gcc/range-op.h                  |  111 +++
 gcc/value-range-pretty-print.cc |   25 +
 gcc/value-range-pretty-print.h  |    1 +
 gcc/value-range-storage.cc      |  117 +++
 gcc/value-range-storage.h       |   33 +
 gcc/value-range.cc              |  354 ++++++-
 gcc/value-range.h               |  214 ++++-
 13 files changed, 2730 insertions(+), 8 deletions(-)

-- 
2.44.0

Reply via email to