diff options
author | Andrew MacLeod <amacleod@redhat.com> | 2022-05-09 13:32:31 -0400 |
---|---|---|
committer | Andrew MacLeod <amacleod@redhat.com> | 2022-05-13 10:54:45 -0400 |
commit | f3204ce1ae6b97f7e79d633844d61d021da8502e (patch) | |
tree | 7b5111a38a27decd2a93d9b7c113a4ca74b3f9f3 /gcc/value-range.h | |
parent | 1d3d7e88aac0db20a4b59044f9b7cd35e847e8d3 (diff) | |
download | gcc-f3204ce1ae6b97f7e79d633844d61d021da8502e.zip gcc-f3204ce1ae6b97f7e79d633844d61d021da8502e.tar.gz gcc-f3204ce1ae6b97f7e79d633844d61d021da8502e.tar.bz2 |
Return a bool result for union, and add performance improvements.
Union_ returns a boolean indicating if the operation changes the range.
Also optimize the common single-pair UNION single-pair case.
* gimple-range-edge.cc (calc_switch_ranges): Check union return value.
* value-range.cc (irange::legacy_verbose_union_): Add return value.
(irange::irange_single_pair_union): New.
(irange::irange_union): Add return value.
* value-range.h (class irange): Adjust prototypes.
Diffstat (limited to 'gcc/value-range.h')
-rw-r--r-- | gcc/value-range.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/value-range.h b/gcc/value-range.h index 4198602..ec59d2e 100644 --- a/gcc/value-range.h +++ b/gcc/value-range.h @@ -71,7 +71,7 @@ public: bool contains_p (tree) const; // In-place operators. - void union_ (const irange &); + bool union_ (const irange &); bool intersect (const irange &); void invert (); @@ -96,7 +96,7 @@ public: bool may_contain_p (tree) const; // DEPRECATED void set (tree); // DEPRECATED bool equal_p (const irange &) const; // DEPRECATED - void legacy_verbose_union_ (const class irange *); // DEPRECATED + bool legacy_verbose_union_ (const class irange *); // DEPRECATED bool legacy_verbose_intersect (const irange *); // DEPRECATED protected: @@ -107,11 +107,12 @@ protected: tree tree_upper_bound () const; // In-place operators. - void irange_union (const irange &); + bool irange_union (const irange &); bool irange_intersect (const irange &); void irange_set (tree, tree); void irange_set_anti_range (tree, tree); bool irange_contains_p (const irange &) const; + bool irange_single_pair_union (const irange &r); void normalize_kind (); @@ -545,13 +546,14 @@ irange::upper_bound () const return upper_bound (pairs - 1); } -inline void +inline bool irange::union_ (const irange &r) { dump_flags_t m_flags = dump_flags; dump_flags &= ~TDF_DETAILS; - irange::legacy_verbose_union_ (&r); + bool ret = irange::legacy_verbose_union_ (&r); dump_flags = m_flags; + return ret; } inline bool |