]> gcc.gnu.org Git - gcc.git/commitdiff
Avoid comparing ranges when sub-ranges is 0.
authorAldy Hernandez <aldyh@redhat.com>
Sat, 1 Oct 2022 20:31:34 +0000 (22:31 +0200)
committerAldy Hernandez <aldyh@redhat.com>
Mon, 3 Oct 2022 11:06:25 +0000 (13:06 +0200)
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.

gcc/value-range.cc

index ddbcdd67633171d59a048d55ba6bf11c02040822..e1066f4946e4c5f1e653f62d8255c100fc2ada22 100644 (file)
@@ -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);
This page took 0.109599 seconds and 5 git commands to generate.