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-1589] Set VR_VARYING in irange::irange_single_pair_union.
Date: Sat,  9 Jul 2022 19:09:30 +0000 (GMT)	[thread overview]
Message-ID: <20220709190930.1C5F5385BAF5@sourceware.org> (raw)

https://gcc.gnu.org/g:030a53c613031d11e11fb7b1b08aec1a736da067

commit r13-1589-g030a53c613031d11e11fb7b1b08aec1a736da067
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Sat Jul 9 17:43:44 2022 +0200

    Set VR_VARYING in irange::irange_single_pair_union.
    
    The fast union operation is sometimes setting a range of the entire
    domain, but leaving the kind bit as VR_RANGE instead of downgrading it
    to VR_VARYING.
    
    Tested on x86-64 Linux.
    
    gcc/ChangeLog:
    
            * value-range.cc (irange::irange_single_pair_union): Set
            VR_VARYING when appropriate.

Diff:
---
 gcc/value-range.cc | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index 25f1acff4a3..fd549b9ca59 100644
--- a/gcc/value-range.cc
+++ b/gcc/value-range.cc
@@ -1777,11 +1777,7 @@ irange::irange_single_pair_union (const irange &r)
       // Check for overlap/touching ranges, or single target range.
       if (m_max_ranges == 1
 	  || wi::to_widest (m_base[1]) + 1 >= wi::to_widest (r.m_base[0]))
-	{
-	  m_base[1] = r.m_base[1];
-	  if (varying_compatible_p ())
-	    m_kind = VR_VARYING;
-	}
+	m_base[1] = r.m_base[1];
       else
 	{
 	  // This is a dual range result.
@@ -1789,8 +1785,8 @@ irange::irange_single_pair_union (const irange &r)
 	  m_base[3] = r.m_base[1];
 	  m_num_ranges = 2;
 	}
-      if (flag_checking)
-	verify_range ();
+      if (varying_compatible_p ())
+	m_kind = VR_VARYING;
       return true;
     }
 
@@ -1817,8 +1813,8 @@ irange::irange_single_pair_union (const irange &r)
       m_base[3] = m_base[1];
       m_base[1] = r.m_base[1];
     }
-  if (flag_checking)
-    verify_range ();
+  if (varying_compatible_p ())
+    m_kind = VR_VARYING;
   return true;
 }
 
@@ -1857,6 +1853,8 @@ irange::irange_union (const irange &r)
     {
       bool ret = irange_single_pair_union (r);
       set_nonzero_bits (saved_nz);
+      if (flag_checking)
+	verify_range ();
       return ret || ret_nz;
     }


                 reply	other threads:[~2022-07-09 19:09 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=20220709190930.1C5F5385BAF5@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).