aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2022-10-01 22:31:34 +0200
committerAldy Hernandez <aldyh@redhat.com>2022-10-03 13:06:25 +0200
commit7f6f1f521fc12d4dbbdd0766d8fb7121d1e5ea8d (patch)
treef395894c8e3cf0e99b5ff637e4c531e3a4cd0581
parent8e1de8d2db2500d9d4d76c91c3c2dab761566a1a (diff)
downloadgcc-7f6f1f521fc12d4dbbdd0766d8fb7121d1e5ea8d.zip
gcc-7f6f1f521fc12d4dbbdd0766d8fb7121d1e5ea8d.tar.gz
gcc-7f6f1f521fc12d4dbbdd0766d8fb7121d1e5ea8d.tar.bz2
Avoid comparing ranges when sub-ranges is 0.
There is nothing else to compare when the number of sub-ranges is 0. gcc/ChangeLog: * value-range.cc (irange::operator==): Early bail on m_num_ranges equal to 0.
-rw-r--r--gcc/value-range.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index ddbcdd6..e1066f4 100644
--- a/gcc/value-range.cc
+++ b/gcc/value-range.cc
@@ -1260,6 +1260,9 @@ irange::operator== (const irange &other) const
if (m_num_ranges != other.m_num_ranges)
return false;
+ if (m_num_ranges == 0)
+ return true;
+
for (unsigned i = 0; i < m_num_ranges; ++i)
{
tree lb = tree_lower_bound (i);