diff mbox series

[COMMITTED] Remove some deprecated irange methods.

Message ID 20220704055823.455550-1-aldyh@redhat.com
State New
Headers show
Series [COMMITTED] Remove some deprecated irange methods. | expand

Commit Message

Aldy Hernandez July 4, 2022, 5:58 a.m. UTC
Tested on x86-64 Linux.

gcc/ChangeLog:

	* ipa-cp.cc (ipcp_vr_lattice::meet_with_1): Use operator!=.
	* ipa-prop.cc (struct ipa_vr_ggc_hash_traits): Same.
	* tree-ssa-loop-unswitch.cc (struct unswitch_predicate): Use set
	with two arguments.
	(find_unswitching_predicates_for_bb): Same.
	* tree-vrp.cc (range_fold_unary_symbolics_p): Same.
	* value-range-equiv.cc (value_range_equiv::equal_p): Use operator==.
	* value-range.cc (irange::equal_p): Rename to...
	(irange::operator==): ...this.
	* value-range.h (irange::set): Remove.
	(irange::operator==): Remove.
	(irange::set_zero): Use set with two arguments.
	* vr-values.cc (vr_values::extract_range_from_binary_expr): Same.
	(vr_values::extract_range_from_unary_expr): Same.
	(check_for_binary_op_overflow): Same.
	(bounds_of_var_in_loop): Same.
---
 gcc/ipa-cp.cc                 |  2 +-
 gcc/ipa-prop.cc               |  2 +-
 gcc/tree-ssa-loop-unswitch.cc |  4 ++--
 gcc/tree-vrp.cc               |  3 ++-
 gcc/value-range-equiv.cc      |  2 +-
 gcc/value-range.cc            |  2 +-
 gcc/value-range.h             | 16 +---------------
 gcc/vr-values.cc              | 20 ++++++++++----------
 8 files changed, 19 insertions(+), 32 deletions(-)
diff mbox series

Patch

diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc
index 18d2559e5a3..543a9334e2c 100644
--- a/gcc/ipa-cp.cc
+++ b/gcc/ipa-cp.cc
@@ -1020,7 +1020,7 @@  ipcp_vr_lattice::meet_with_1 (const value_range *other_vr)
 
   value_range save (m_vr);
   m_vr.union_ (*other_vr);
-  return !m_vr.equal_p (save);
+  return m_vr != save;
 }
 
 /* Return true if value range information in the lattice is yet unknown.  */
diff --git a/gcc/ipa-prop.cc b/gcc/ipa-prop.cc
index 77915632fa8..fb8f97397dc 100644
--- a/gcc/ipa-prop.cc
+++ b/gcc/ipa-prop.cc
@@ -126,7 +126,7 @@  struct ipa_vr_ggc_hash_traits : public ggc_cache_remove <value_range *>
   static bool
   equal (const value_range *a, const value_range *b)
     {
-      return (a->equal_p (*b)
+      return (*a == *b
 	      && types_compatible_p (a->type (), b->type ()));
     }
   static const bool empty_zero_p = true;
diff --git a/gcc/tree-ssa-loop-unswitch.cc b/gcc/tree-ssa-loop-unswitch.cc
index afae9825eda..3a827f2f904 100644
--- a/gcc/tree-ssa-loop-unswitch.cc
+++ b/gcc/tree-ssa-loop-unswitch.cc
@@ -139,7 +139,7 @@  struct unswitch_predicate
 	auto range_op = range_op_handler (code, TREE_TYPE (lhs));
 	int_range<2> rhs_range (TREE_TYPE (rhs));
 	if (CONSTANT_CLASS_P (rhs))
-	  rhs_range.set (rhs);
+	  rhs_range.set (rhs, rhs);
 	if (!range_op.op1_range (true_range, TREE_TYPE (lhs),
 				 int_range<2> (boolean_true_node,
 					       boolean_true_node), rhs_range)
@@ -535,7 +535,7 @@  find_unswitching_predicates_for_bb (basic_block bb, class loop *loop,
 	  else
 	    {
 	      cmp = fold_build2 (EQ_EXPR, boolean_type_node, idx, low);
-	      lab_range.set (low);
+	      lab_range.set (low, low);
 	    }
 
 	  /* Combine the expression with the existing one.  */
diff --git a/gcc/tree-vrp.cc b/gcc/tree-vrp.cc
index 2d15bb5a650..ed881be7e5f 100644
--- a/gcc/tree-vrp.cc
+++ b/gcc/tree-vrp.cc
@@ -1024,7 +1024,8 @@  range_fold_unary_symbolics_p (value_range *vr,
 	{
 	  /* ~X is simply -1 - X.  */
 	  value_range minusone;
-	  minusone.set (build_int_cst (vr0->type (), -1));
+	  tree t = build_int_cst (vr0->type (), -1);
+	  minusone.set (t, t);
 	  range_fold_binary_expr (vr, MINUS_EXPR, expr_type, &minusone, vr0);
 	  return true;
 	}
diff --git a/gcc/value-range-equiv.cc b/gcc/value-range-equiv.cc
index b0ae1288a09..bd58e5a90bc 100644
--- a/gcc/value-range-equiv.cc
+++ b/gcc/value-range-equiv.cc
@@ -162,7 +162,7 @@  bool
 value_range_equiv::equal_p (const value_range_equiv &other,
 			    bool ignore_equivs) const
 {
-  return (value_range::equal_p (other)
+  return (value_range::operator== (other)
 	  && (ignore_equivs || vr_bitmap_equal_p (m_equiv, other.m_equiv)));
 }
 
diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index 815cb783abc..574c51002b5 100644
--- a/gcc/value-range.cc
+++ b/gcc/value-range.cc
@@ -688,7 +688,7 @@  irange::legacy_equal_p (const irange &other) const
 }
 
 bool
-irange::equal_p (const irange &other) const
+irange::operator== (const irange &other) const
 {
   if (legacy_mode_p ())
     {
diff --git a/gcc/value-range.h b/gcc/value-range.h
index 8ee7793baeb..fd6703138ac 100644
--- a/gcc/value-range.h
+++ b/gcc/value-range.h
@@ -157,8 +157,6 @@  public:
   void normalize_symbolics ();			// DEPRECATED
   void normalize_addresses ();			// DEPRECATED
   bool may_contain_p (tree) const;		// DEPRECATED
-  void set (tree);				// DEPRECATED
-  bool equal_p (const irange &) const;		// DEPRECATED
   bool legacy_verbose_union_ (const class irange *);	// DEPRECATED
   bool legacy_verbose_intersect (const irange *);	// DEPRECATED
 
@@ -719,12 +717,6 @@  int_range<N>::operator= (const int_range &src)
   return *this;
 }
 
-inline void
-irange::set (tree val)
-{
-  set (val, val);
-}
-
 inline void
 irange::set_undefined ()
 {
@@ -765,12 +757,6 @@  irange::set_varying (tree type)
     m_base[0] = m_base[1] = error_mark_node;
 }
 
-inline bool
-irange::operator== (const irange &r) const
-{
-  return equal_p (r);
-}
-
 // Return the lower bound of a sub-range.  PAIR is the sub-range in
 // question.
 
@@ -846,7 +832,7 @@  irange::set_zero (tree type)
 {
   tree z = build_int_cst (type, 0);
   if (legacy_mode_p ())
-    set (z);
+    set (z, z);
   else
     irange_set (z, z);
 }
diff --git a/gcc/vr-values.cc b/gcc/vr-values.cc
index 38f204e2f5d..6b9c630fed3 100644
--- a/gcc/vr-values.cc
+++ b/gcc/vr-values.cc
@@ -831,14 +831,14 @@  vr_values::extract_range_from_binary_expr (value_range_equiv *vr,
   if (TREE_CODE (op0) == SSA_NAME)
     vr0 = *(get_value_range (op0));
   else if (is_gimple_min_invariant (op0))
-    vr0.set (op0);
+    vr0.set (op0, op0);
   else
     vr0.set_varying (TREE_TYPE (op0));
 
   if (TREE_CODE (op1) == SSA_NAME)
     vr1 = *(get_value_range (op1));
   else if (is_gimple_min_invariant (op1))
-    vr1.set (op1);
+    vr1.set (op1, op1);
   else
     vr1.set_varying (TREE_TYPE (op1));
 
@@ -936,7 +936,7 @@  vr_values::extract_range_from_binary_expr (value_range_equiv *vr,
 
       /* Try with [OP0, OP0] and VR1.  */
       else
-	n_vr0.set (op0);
+	n_vr0.set (op0, op0);
 
       range_fold_binary_expr (vr, code, expr_type, &n_vr0, &vr1);
     }
@@ -976,7 +976,7 @@  vr_values::extract_range_from_unary_expr (value_range_equiv *vr,
   if (TREE_CODE (op0) == SSA_NAME)
     vr0 = *(get_value_range (op0));
   else if (is_gimple_min_invariant (op0))
-    vr0.set (op0);
+    vr0.set (op0, op0);
   else
     vr0.set_varying (type);
 
@@ -1064,14 +1064,14 @@  check_for_binary_op_overflow (range_query *query,
   if (TREE_CODE (op0) == SSA_NAME)
     vr0 = *query->get_value_range (op0, s);
   else if (TREE_CODE (op0) == INTEGER_CST)
-    vr0.set (op0);
+    vr0.set (op0, op0);
   else
     vr0.set_varying (TREE_TYPE (op0));
 
   if (TREE_CODE (op1) == SSA_NAME)
     vr1 = *query->get_value_range (op1, s);
   else if (TREE_CODE (op1) == INTEGER_CST)
-    vr1.set (op1);
+    vr1.set (op1, op1);
   else
     vr1.set_varying (TREE_TYPE (op1));
 
@@ -1747,7 +1747,7 @@  bounds_of_var_in_loop (tree *min, tree *max, range_query *query,
 	      if (TREE_CODE (init) == SSA_NAME)
 		query->range_of_expr (vr0, init, stmt);
 	      else if (is_gimple_min_invariant (init))
-		vr0.set (init);
+		vr0.set (init, init);
 	      else
 		vr0.set_varying (TREE_TYPE (init));
 	      tree tem = wide_int_to_tree (TREE_TYPE (init), wtmp);
@@ -1763,7 +1763,7 @@  bounds_of_var_in_loop (tree *min, tree *max, range_query *query,
 		  if (TREE_CODE (init) == SSA_NAME)
 		    query->range_of_expr (initvr, init, stmt);
 		  else if (is_gimple_min_invariant (init))
-		    initvr.set (init);
+		    initvr.set (init, init);
 		  else
 		    return false;
 
@@ -3291,14 +3291,14 @@  simplify_using_ranges::simplify_bit_ops_using_ranges
   if (TREE_CODE (op0) == SSA_NAME)
     vr0 = *(query->get_value_range (op0, stmt));
   else if (is_gimple_min_invariant (op0))
-    vr0.set (op0);
+    vr0.set (op0, op0);
   else
     return false;
 
   if (TREE_CODE (op1) == SSA_NAME)
     vr1 = *(query->get_value_range (op1, stmt));
   else if (is_gimple_min_invariant (op1))
-    vr1.set (op1);
+    vr1.set (op1, op1);
   else
     return false;