public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-3026] Avoid comparing ranges when sub-ranges is 0.
@ 2022-10-03 11:08 Aldy Hernandez
0 siblings, 0 replies; only message in thread
From: Aldy Hernandez @ 2022-10-03 11:08 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:7f6f1f521fc12d4dbbdd0766d8fb7121d1e5ea8d
commit r13-3026-g7f6f1f521fc12d4dbbdd0766d8fb7121d1e5ea8d
Author: Aldy Hernandez <aldyh@redhat.com>
Date: Sat Oct 1 22:31:34 2022 +0200
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:
---
gcc/value-range.cc | 3 +++
1 file changed, 3 insertions(+)
diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index ddbcdd67633..e1066f4946e 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);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-10-03 11:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-03 11:08 [gcc r13-3026] Avoid comparing ranges when sub-ranges is 0 Aldy Hernandez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).