From: Aldy Hernandez <aldyh@redhat.com>
To: GCC patches <gcc-patches@gcc.gnu.org>
Subject: [COMMITTED] Set VR_VARYING in irange::irange_single_pair_union.
Date: Sat, 9 Jul 2022 21:09:16 +0200 [thread overview]
Message-ID: <20220709190916.323267-1-aldyh@redhat.com> (raw)
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.
---
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;
}
--
2.36.1
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=20220709190916.323267-1-aldyh@redhat.com \
--to=aldyh@redhat.com \
--cc=gcc-patches@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).