aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-range-edge.cc
diff options
context:
space:
mode:
authorAndrew MacLeod <amacleod@redhat.com>2022-05-09 13:32:31 -0400
committerAndrew MacLeod <amacleod@redhat.com>2022-05-13 10:54:45 -0400
commitf3204ce1ae6b97f7e79d633844d61d021da8502e (patch)
tree7b5111a38a27decd2a93d9b7c113a4ca74b3f9f3 /gcc/gimple-range-edge.cc
parent1d3d7e88aac0db20a4b59044f9b7cd35e847e8d3 (diff)
downloadgcc-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/gimple-range-edge.cc')
-rw-r--r--gcc/gimple-range-edge.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/gimple-range-edge.cc b/gcc/gimple-range-edge.cc
index 6caa07c..0bee38b 100644
--- a/gcc/gimple-range-edge.cc
+++ b/gcc/gimple-range-edge.cc
@@ -154,7 +154,9 @@ gimple_outgoing_range::calc_switch_ranges (gswitch *sw)
irange *&slot = m_edge_table->get_or_insert (e, &existed);
if (existed)
{
- case_range.union_ (*slot);
+ // If this doesn't change the value, move on.
+ if (!case_range.union_ (*slot))
+ continue;
if (slot->fits_p (case_range))
{
*slot = case_range;