From: Aldy Hernandez Date: Sat, 1 Oct 2022 20:31:34 +0000 (+0200) Subject: Avoid comparing ranges when sub-ranges is 0. X-Git-Tag: basepoints/gcc-14~4181 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7f6f1f521fc12d4dbbdd0766d8fb7121d1e5ea8d;p=thirdparty%2Fgcc.git 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. --- diff --git a/gcc/value-range.cc b/gcc/value-range.cc index ddbcdd676331..e1066f4946e4 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);