public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-30] Make irange::intersect(wide_int, wide_int) private.
@ 2022-04-29  9:08 Aldy Hernandez
  0 siblings, 0 replies; only message in thread
From: Aldy Hernandez @ 2022-04-29  9:08 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:71f2928e282eb7863de8426e41c38a90c436d41d

commit r13-30-g71f2928e282eb7863de8426e41c38a90c436d41d
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Mon Mar 7 14:48:58 2022 +0100

    Make irange::intersect(wide_int, wide_int) private.
    
    This method should have been private, and somehow seeped into the API.
    
    Tested and benchmarked on x86-64 Linux.
    
    gcc/ChangeLog:
    
            * gimple-range-cache.h (non_null_ref::adjust_range): Do not use
            irange::intersect (wide_int, wide_int).
            * gimple-range-fold.cc (adjust_pointer_diff_expr): Same.
            (adjust_imagpart_expr): Same.
            * value-range.h (irange::intersect (wide_int, wide_int)): Make
            private.

Diff:
---
 gcc/gimple-range-cache.h | 6 ++++--
 gcc/gimple-range-fold.cc | 6 +++---
 gcc/value-range.h        | 2 +-
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/gcc/gimple-range-cache.h b/gcc/gimple-range-cache.h
index 589b649da26..a0244e4f6a4 100644
--- a/gcc/gimple-range-cache.h
+++ b/gcc/gimple-range-cache.h
@@ -64,8 +64,10 @@ non_null_ref::adjust_range (irange &r, tree name, basic_block bb,
   if (non_null_deref_p (name, bb, search_dom))
     {
       // Remove zero from the range.
-      unsigned prec = TYPE_PRECISION (TREE_TYPE (name));
-      r.intersect (wi::one (prec), wi::max_value (prec, UNSIGNED));
+      gcc_checking_assert (TYPE_UNSIGNED (TREE_TYPE (name)));
+      int_range<2> nz;
+      nz.set_nonzero (TREE_TYPE (name));
+      r.intersect (nz);
       return true;
     }
   return false;
diff --git a/gcc/gimple-range-fold.cc b/gcc/gimple-range-fold.cc
index dfacf6f14dc..3169e29b5de 100644
--- a/gcc/gimple-range-fold.cc
+++ b/gcc/gimple-range-fold.cc
@@ -362,7 +362,7 @@ adjust_pointer_diff_expr (irange &res, const gimple *diff_stmt)
       tree max = vrp_val_max (ptrdiff_type_node);
       unsigned prec = TYPE_PRECISION (TREE_TYPE (max));
       wide_int wmaxm1 = wi::to_wide (max, prec) - 1;
-      res.intersect (wi::zero (prec), wmaxm1);
+      res.intersect (int_range<2> (TREE_TYPE (max), wi::zero (prec), wmaxm1));
     }
 }
 
@@ -403,8 +403,8 @@ adjust_imagpart_expr (irange &res, const gimple *stmt)
       tree cst = gimple_assign_rhs1 (def_stmt);
       if (TREE_CODE (cst) == COMPLEX_CST)
 	{
-	  wide_int imag = wi::to_wide (TREE_IMAGPART (cst));
-	  res.intersect (imag, imag);
+	  int_range<2> imag (TREE_IMAGPART (cst), TREE_IMAGPART (cst));
+	  res.intersect (imag);
 	}
     }
 }
diff --git a/gcc/value-range.h b/gcc/value-range.h
index d4cba22d540..fe7795b55a6 100644
--- a/gcc/value-range.h
+++ b/gcc/value-range.h
@@ -73,7 +73,6 @@ public:
   // In-place operators.
   void union_ (const irange &);
   void intersect (const irange &);
-  void intersect (const wide_int& lb, const wide_int& ub);
   void invert ();
 
   // Operator overloads.
@@ -135,6 +134,7 @@ private:
   void irange_set_1bit_anti_range (tree, tree);
   bool varying_compatible_p () const;
 
+  void intersect (const wide_int& lb, const wide_int& ub);
   unsigned char m_num_ranges;
   unsigned char m_max_ranges;
   ENUM_BITFIELD(value_range_kind) m_kind : 8;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-29  9:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-29  9:08 [gcc r13-30] Make irange::intersect(wide_int, wide_int) private Aldy Hernandez

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