public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Aldy Hernandez <aldyh@redhat.com>
To: GCC patches <gcc-patches@gcc.gnu.org>
Subject: [COMMITTED] Tweaks to global ranges.
Date: Sun, 24 Jul 2022 17:04:30 +0200	[thread overview]
Message-ID: <20220724150431.2010479-3-aldyh@redhat.com> (raw)
In-Reply-To: <20220724150431.2010479-1-aldyh@redhat.com>

The global get_nonzero_bits was previously returning -1 for
unsupported types.  I dropped this in the conversion to global ranges
and it's causing a problem in the frange work, where CCP is asking for
the nonzero bits of non-integral types.  CCP may require further
tweaks, but for now, restore the original behavior.

Also, I'm removing old checks for precision that no longer hold, now
that we handle various types for global ranges.

Tested on x86-64 Linux.

gcc/ChangeLog:

	* tree-ssanames.cc (get_nonzero_bits): Return -1 for unsupported
	types.
	* value-query.cc (get_ssa_name_range_info): Remove precision check.
---
 gcc/tree-ssanames.cc | 3 +--
 gcc/value-query.cc   | 9 +++------
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/gcc/tree-ssanames.cc b/gcc/tree-ssanames.cc
index 9389454a5a7..5c5d0e346c4 100644
--- a/gcc/tree-ssanames.cc
+++ b/gcc/tree-ssanames.cc
@@ -489,13 +489,12 @@ get_nonzero_bits (const_tree name)
       return wi::shwi (-1, precision);
     }
 
-  if (!range_info_p (name))
+  if (!range_info_p (name) || !irange::supports_p (TREE_TYPE (name)))
     return wi::shwi (-1, precision);
 
   /* Optimization to get at the nonzero bits because we know the
      storage type.  This saves us measurable time compared to going
      through vrange_storage.  */
-  gcc_checking_assert (irange::supports_p (TREE_TYPE (name)));
   irange_storage_slot *ri
     = static_cast <irange_storage_slot *> (SSA_NAME_RANGE_INFO (name));
   return ri->get_nonzero_bits ();
diff --git a/gcc/value-query.cc b/gcc/value-query.cc
index 51911bdd1d0..3560d19f1ae 100644
--- a/gcc/value-query.cc
+++ b/gcc/value-query.cc
@@ -280,16 +280,13 @@ get_ssa_name_range_info (vrange &r, const_tree name)
 
   void *ri = SSA_NAME_RANGE_INFO (name);
 
-  // Return VR_VARYING for SSA_NAMEs with NULL RANGE_INFO or SSA_NAMEs
-  // with integral types width > 2 * HOST_BITS_PER_WIDE_INT precision.
-  if (!ri || (GET_MODE_PRECISION (SCALAR_INT_TYPE_MODE (TREE_TYPE (name)))
-	      > 2 * HOST_BITS_PER_WIDE_INT))
-    r.set_varying (type);
-  else
+  if (ri)
     {
       vrange_storage vstore (NULL);
       vstore.get_vrange (ri, r, TREE_TYPE (name));
     }
+  else
+    r.set_varying (type);
 }
 
 // Return nonnull attribute of pointer NAME from SSA_NAME_PTR_INFO.
-- 
2.36.1


  parent reply	other threads:[~2022-07-24 15:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-24 15:04 [COMMITTED] Convert some uses in ranger_cache and DOM to vrange Aldy Hernandez
2022-07-24 15:04 ` [COMMITTED] Allow registering same SSA name relations in oracle Aldy Hernandez
2022-07-24 15:04 ` Aldy Hernandez [this message]
2022-07-24 15:04 ` [COMMITTED] Minor fixes to vr_values to not die on non integral types Aldy Hernandez

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=20220724150431.2010479-3-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).