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 r14-253] Remove irange::constant_p.
Date: Wed, 26 Apr 2023 08:36:53 +0000 (GMT)	[thread overview]
Message-ID: <20230426083653.DE4B938708DA@sourceware.org> (raw)

https://gcc.gnu.org/g:964b02cb26df1016d036de6720e9d4decf87cc6f

commit r14-253-g964b02cb26df1016d036de6720e9d4decf87cc6f
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Mon Nov 21 11:45:47 2022 +0100

    Remove irange::constant_p.
    
    gcc/ChangeLog:
    
            * value-range-pretty-print.cc (vrange_printer::visit): Remove
            constant_p use.
            * value-range.cc (irange::constant_p): Remove.
            (irange::get_nonzero_bits_from_range): Remove constant_p use.
            * value-range.h (class irange): Remove constant_p.
            (irange::num_pairs): Remove constant_p use.

Diff:
---
 gcc/value-range-pretty-print.cc | 13 -------------
 gcc/value-range.cc              | 14 --------------
 gcc/value-range.h               |  8 ++++++--
 3 files changed, 6 insertions(+), 29 deletions(-)

diff --git a/gcc/value-range-pretty-print.cc b/gcc/value-range-pretty-print.cc
index d20e2562431..a11c5a621f8 100644
--- a/gcc/value-range-pretty-print.cc
+++ b/gcc/value-range-pretty-print.cc
@@ -63,19 +63,6 @@ vrange_printer::visit (const irange &r) const
       pp_string (pp, "VARYING");
       return;
     }
-  // Handle legacy symbolics.
-  if (!r.constant_p ())
-    {
-      if (r.kind () == VR_ANTI_RANGE)
-	pp_character (pp, '~');
-      pp_character (pp, '[');
-      dump_generic_node (pp, r.min (), 0, TDF_NONE, false);
-      pp_string (pp, ", ");
-      dump_generic_node (pp, r.max (), 0, TDF_NONE, false);
-      pp_character (pp, ']');
-      print_irange_bitmasks (r);
-      return;
-    }
   for (unsigned i = 0; i < r.num_pairs (); ++i)
     {
       pp_character (pp, '[');
diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index ebadea8b917..58ae2c157db 100644
--- a/gcc/value-range.cc
+++ b/gcc/value-range.cc
@@ -1351,16 +1351,6 @@ irange::operator== (const irange &other) const
   return nz1 == nz2;
 }
 
-/* Return TRUE if this is a constant range.  */
-
-bool
-irange::constant_p () const
-{
-  return (m_num_ranges > 0
-	  && TREE_CODE (min ()) == INTEGER_CST
-	  && TREE_CODE (max ()) == INTEGER_CST);
-}
-
 /* If range is a singleton, place it in RESULT and return TRUE.
    Note: A singleton can be any gimple invariant, not just constants.
    So, [&x, &x] counts as a singleton.  */
@@ -2835,10 +2825,6 @@ irange::invert ()
 wide_int
 irange::get_nonzero_bits_from_range () const
 {
-  // For legacy symbolics.
-  if (!constant_p ())
-    return wi::shwi (-1, TYPE_PRECISION (type ()));
-
   wide_int min = lower_bound ();
   wide_int max = upper_bound ();
   wide_int xorv = min ^ max;
diff --git a/gcc/value-range.h b/gcc/value-range.h
index 1012d007261..2442f8eed70 100644
--- a/gcc/value-range.h
+++ b/gcc/value-range.h
@@ -169,7 +169,6 @@ public:
   // Deprecated legacy public methods.
   tree min () const;				// DEPRECATED
   tree max () const;				// DEPRECATED
-  bool constant_p () const;			// DEPRECATED
   bool legacy_verbose_union_ (const class irange *);	// DEPRECATED
   bool legacy_verbose_intersect (const irange *);	// DEPRECATED
 
@@ -692,7 +691,12 @@ inline unsigned
 irange::num_pairs () const
 {
   if (m_kind == VR_ANTI_RANGE)
-    return constant_p () ? 2 : 1;
+    {
+      bool constant_p = (TREE_CODE (min ()) == INTEGER_CST
+			 && TREE_CODE (max ()) == INTEGER_CST);
+      gcc_checking_assert (constant_p);
+      return 2;
+    }
   else
     return m_num_ranges;
 }

                 reply	other threads:[~2023-04-26  8:36 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=20230426083653.DE4B938708DA@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).