aboutsummaryrefslogtreecommitdiff
path: root/gcc/value-range.h
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2021-04-17 17:44:37 +0200
committerAldy Hernandez <aldyh@redhat.com>2021-04-26 18:21:02 +0200
commitdb3581c4ae4d44edea2b64347095d14363721668 (patch)
tree76e5c19deffe47516e2e0dbfeaa4b7354001c2a1 /gcc/value-range.h
parentdc80d5e887ea4fa0e1e950db5f6bdd765c960c22 (diff)
downloadgcc-db3581c4ae4d44edea2b64347095d14363721668.zip
gcc-db3581c4ae4d44edea2b64347095d14363721668.tar.gz
gcc-db3581c4ae4d44edea2b64347095d14363721668.tar.bz2
Cache irange::num_pairs() for non-legacy code.
This does for num_pairs() what my previous patch did for VR_UNDEFINED and VR_VARYING. Note that VR_ANTI_RANGE for legacy is always set to 2 ranges. There is only one way of representing a range, so a range that can be represented as a VR_RANGE will never have a kind of VR_ANTI_RANGE. Also legacy symbolics can also use VR_ANTI_RANGE, but no one will ever ask for the bounds of such range, so m_num_ranges is irrelevant. gcc/ChangeLog: * value-range.cc (irange::legacy_num_pairs): Remove. (irange::invert): Change gcc_assert to gcc_checking_assert. * value-range.h (irange::num_pairs): Adjust for a cached num_pairs(). Also, rename all gcc_assert's to gcc_checking_assert's.
Diffstat (limited to 'gcc/value-range.h')
-rw-r--r--gcc/value-range.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/gcc/value-range.h b/gcc/value-range.h
index e000432..7e36e21 100644
--- a/gcc/value-range.h
+++ b/gcc/value-range.h
@@ -118,7 +118,6 @@ protected:
void legacy_union (irange *, const irange *);
void legacy_intersect (irange *, const irange *);
void verify_range ();
- unsigned legacy_num_pairs () const;
wide_int legacy_lower_bound (unsigned = 0) const;
wide_int legacy_upper_bound (unsigned) const;
int value_inside_range (tree) const;
@@ -207,10 +206,10 @@ irange::kind () const
inline unsigned
irange::num_pairs () const
{
- if (!legacy_mode_p ())
- return m_num_ranges;
+ if (m_kind == VR_ANTI_RANGE)
+ return constant_p () ? 2 : 1;
else
- return legacy_num_pairs ();
+ return m_num_ranges;
}
inline tree