diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2024-05-04 06:45:18 +0200 |
---|---|---|
committer | Aldy Hernandez <aldyh@redhat.com> | 2024-05-04 10:25:23 +0200 |
commit | f5891967947562060076956bd953e5df4c7289bf (patch) | |
tree | c974eb917939bf9ccb2d2cacbd7b789b0ed9183e /gcc | |
parent | 3e3d115c946944c81d8231dfbe778d4dae26cbb7 (diff) | |
download | gcc-f5891967947562060076956bd953e5df4c7289bf.zip gcc-f5891967947562060076956bd953e5df4c7289bf.tar.gz gcc-f5891967947562060076956bd953e5df4c7289bf.tar.bz2 |
Minimal prange class showing inlining degradation to VRP.
There is a 2% slowdown to VRP unrelated to the work at hand. This patch
is a skeleton implementation of prange that exhibits this degradation. It
is meant as a place in the commit history we can return to in order to revisit
the issue.
The relevant discussion is here:
https://gcc.gnu.org/pipermail/gcc/2024-May/243898.html
gcc/ChangeLog:
* value-range.h (class prange): New.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/value-range.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/gcc/value-range.h b/gcc/value-range.h index 934eec9..f52d516 100644 --- a/gcc/value-range.h +++ b/gcc/value-range.h @@ -378,6 +378,39 @@ private: wide_int m_ranges[N*2]; }; +class prange : public vrange +{ +public: + static bool supports_p (const_tree) { return false; } + virtual bool supports_type_p (const_tree) const final override { return false; } + virtual void accept (const vrange_visitor &) const final override {} + virtual void set_undefined () final override {} + virtual void set_varying (tree) final override {} + virtual void set_nonzero (tree) final override {} + virtual void set_zero (tree) final override; + virtual void set_nonnegative (tree) final override {} + virtual bool contains_p (tree) const final override { return false; } + virtual bool fits_p (const vrange &) const final override { return false; } + virtual bool singleton_p (tree * = NULL) const final override { return false; } + virtual bool zero_p () const final override { return false; } + virtual bool nonzero_p () const final override { return false; } + virtual void set (tree, tree, value_range_kind = VR_RANGE) final override {} + virtual tree type () const final override { return NULL; } + virtual bool union_ (const vrange &) final override { return false; } + virtual bool intersect (const vrange &) final override { return false; } + virtual tree lbound () const final override { return NULL; } + virtual tree ubound () const final override { return NULL; } + + wide_int lower_bound () const; + wide_int upper_bound () const; + irange_bitmask get_bitmask () const final override; + void update_bitmask (const irange_bitmask &) final override {} +private: + wide_int m_min; + wide_int m_max; + irange_bitmask m_bitmask; +}; + // Unsupported temporaries may be created by ranger before it's known // they're unsupported, or by vr_values::get_value_range. @@ -1187,6 +1220,32 @@ irange_val_max (const_tree type) return wi::max_value (TYPE_PRECISION (type), TYPE_SIGN (type)); } +inline void +prange::set_zero (tree type) +{ + wide_int zero = wi::zero (TYPE_PRECISION (type)); + m_min = m_max = zero; + m_bitmask = irange_bitmask (zero, zero); +} + +inline wide_int +prange::lower_bound () const +{ + return m_min; +} + +inline wide_int +prange::upper_bound () const +{ + return m_max; +} + +inline irange_bitmask +prange::get_bitmask () const +{ + return m_bitmask; +} + inline frange::frange () : vrange (VR_FRANGE) |