public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Aldy Hernandez <aldyh@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-3026] Avoid comparing ranges when sub-ranges is 0.
Date: Mon,  3 Oct 2022 11:08:44 +0000 (GMT)	[thread overview]
Message-ID: <20221003110844.117953854170@sourceware.org> (raw)

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);

                 reply	other threads:[~2022-10-03 11:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221003110844.117953854170@sourceware.org \
    --to=aldyh@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).