diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2023-05-03 10:48:41 +0200 |
---|---|---|
committer | Aldy Hernandez <aldyh@redhat.com> | 2023-05-06 07:42:00 +0200 |
commit | 143e6695b20d3522e11f6e74b587993f9f619ccb (patch) | |
tree | 8374c47e78dad5b36bd12343274f997cf55ecdb9 /gcc/value-range-storage.cc | |
parent | 8421f279e9eb00a2342ee3630dcdaf735b734fe8 (diff) | |
download | gcc-143e6695b20d3522e11f6e74b587993f9f619ccb.zip gcc-143e6695b20d3522e11f6e74b587993f9f619ccb.tar.gz gcc-143e6695b20d3522e11f6e74b587993f9f619ccb.tar.bz2 |
Remove type from vrange_storage::equal_p.
The equal_p method in vrange_storage is only used to compare ranges
that are the same type. No sense passing the type if it can be
determined from the range being compared.
gcc/ChangeLog:
* gimple-range-cache.cc (sbr_sparse_bitmap::set_bb_range): Do not
pass type to vrange_storage::equal_p.
* value-range-storage.cc (vrange_storage::equal_p): Remove type.
(irange_storage::equal_p): Same.
(frange_storage::equal_p): Same.
* value-range-storage.h (class frange_storage): Same.
Diffstat (limited to 'gcc/value-range-storage.cc')
-rw-r--r-- | gcc/value-range-storage.cc | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/gcc/value-range-storage.cc b/gcc/value-range-storage.cc index 14bec50..2f82739 100644 --- a/gcc/value-range-storage.cc +++ b/gcc/value-range-storage.cc @@ -205,20 +205,22 @@ vrange_storage::fits_p (const vrange &r) const return false; } -// Return TRUE if the range in storage is equal to R. +// Return TRUE if the range in storage is equal to R. It is the +// caller's responsibility to verify that the type of the range in +// storage matches that of R. bool -vrange_storage::equal_p (const vrange &r, tree type) const +vrange_storage::equal_p (const vrange &r) const { if (is_a <irange> (r)) { const irange_storage *s = static_cast <const irange_storage *> (this); - return s->equal_p (as_a <irange> (r), type); + return s->equal_p (as_a <irange> (r)); } if (is_a <frange> (r)) { const frange_storage *s = static_cast <const frange_storage *> (this); - return s->equal_p (as_a <frange> (r), type); + return s->equal_p (as_a <frange> (r)); } gcc_unreachable (); } @@ -374,21 +376,17 @@ irange_storage::get_irange (irange &r, tree type) const } bool -irange_storage::equal_p (const irange &r, tree type) const +irange_storage::equal_p (const irange &r) const { if (m_kind == VR_UNDEFINED || r.undefined_p ()) return m_kind == r.m_kind; if (m_kind == VR_VARYING || r.varying_p ()) - return m_kind == r.m_kind && types_compatible_p (r.type (), type); - - tree rtype = r.type (); - if (!types_compatible_p (rtype, type)) - return false; + return m_kind == r.m_kind; // ?? We could make this faster by doing the comparison in place, // without going through get_irange. int_range_max tmp; - get_irange (tmp, rtype); + get_irange (tmp, r.type ()); return tmp == r; } @@ -525,17 +523,13 @@ frange_storage::get_frange (frange &r, tree type) const } bool -frange_storage::equal_p (const frange &r, tree type) const +frange_storage::equal_p (const frange &r) const { if (r.undefined_p ()) return m_kind == VR_UNDEFINED; - tree rtype = type; - if (!types_compatible_p (rtype, type)) - return false; - frange tmp; - get_frange (tmp, rtype); + get_frange (tmp, r.type ()); return tmp == r; } |