Remove various deprecated methods in class irange.
authorAldy Hernandez <aldyh@redhat.com>
Mon, 14 Mar 2022 08:57:48 +0000 (09:57 +0100)
committerAldy Hernandez <aldyh@redhat.com>
Fri, 29 Apr 2022 08:44:18 +0000 (10:44 +0200)
This patch cleans up some irange methods in preparation for other
cleanups later in the cycle.

First, we prefer the reference overloads for union and intersect as
the pointer versions have been deprecated for a couple releases.

Also, I've renamed the legacy union/intersect whose only function was
to provide additional verbosity for VRP into
legacy_verbose_{union,intersect}.  This is a temporary rename to serve
as a visual reminder of which of the methods are bound for the chopping
block when the legacy code gets removed later this cycle.

Tested on x86-64 Linux.

gcc/ChangeLog:

* gimple-fold.cc (size_must_be_zero_p): Use reference
instead of pointer
* gimple-ssa-evrp-analyze.cc
(evrp_range_analyzer::record_ranges_from_incoming_edge): Rename
intersect to legacy_verbose_intersect.
* ipa-cp.cc (ipcp_vr_lattice::meet_with_1): Use reference instead
of pointer.
* tree-ssa-dom.cc (dom_jt_simplifier::simplify): Use value_range
instead of value_range_equiv.
* tree-vrp.cc (extract_range_from_plus_minus_expr): Use reference
instead of pointer.
(find_case_label_range): Same.
* value-range-equiv.cc (value_range_equiv::intersect): Rename to...
(value_range_equiv::legacy_verbose_intersect): ...this.
(value_range_equiv::union_): Rename to...
(value_range_equiv::legacy_verbose_union_): ...this.
* value-range-equiv.h (class value_range_equiv): Rename union and
intersect to legacy_verbose_{intersect,union}.
* value-range.cc (irange::union_): Rename to...
(irange::legacy_verbose_union_): ...this.
(irange::intersect): Rename to...
(irange::legacy_verbose_intersect): ...this.
* value-range.h (irange::union_): Rename union_ to
legacy_verbose_union.
(irange::intersect): Rename intersect to legacy_verbose_intersect.
* vr-values.cc (vr_values::update_value_range): Same.
(vr_values::extract_range_for_var_from_comparison_expr): Same.
(vr_values::extract_range_from_cond_expr): Rename union_ to
legacy_verbose_union.
(vr_values::extract_range_from_phi_node): Same.

gcc/gimple-fold.cc
gcc/gimple-ssa-evrp-analyze.cc
gcc/ipa-cp.cc
gcc/tree-ssa-dom.cc
gcc/tree-vrp.cc
gcc/value-range-equiv.cc
gcc/value-range-equiv.h
gcc/value-range.cc
gcc/value-range.h
gcc/vr-values.cc

index 863ee3d..7baec11 100644 (file)
@@ -883,7 +883,7 @@ size_must_be_zero_p (tree size)
     get_global_range_query ()->range_of_expr (vr, size);
   if (vr.undefined_p ())
     vr.set_varying (TREE_TYPE (size));
-  vr.intersect (&valid_range);
+  vr.intersect (valid_range);
   return vr.zero_p ();
 }
 
index 5b6c9f8..fec6e87 100644 (file)
@@ -207,7 +207,7 @@ evrp_range_analyzer::record_ranges_from_incoming_edge (basic_block bb)
              const value_range_equiv *old_vr
                = get_value_range (vrs[i].first);
              value_range tem (*old_vr);
-             tem.intersect (vrs[i].second);
+             tem.legacy_verbose_intersect (vrs[i].second);
              if (tem.equal_p (*old_vr))
                {
                  free_value_range (vrs[i].second);
index dc3f0e9..11f4a32 100644 (file)
@@ -1018,7 +1018,7 @@ ipcp_vr_lattice::meet_with_1 (const value_range *other_vr)
     return set_to_bottom ();
 
   value_range save (m_vr);
-  m_vr.union_ (other_vr);
+  m_vr.union_ (*other_vr);
   return !m_vr.equal_p (save);
 }
 
index 21745bf..4a0cf2e 100644 (file)
@@ -694,7 +694,7 @@ dom_jt_simplifier::simplify (gimple *stmt, gimple *within_stmt,
       if (TREE_CODE (op) != SSA_NAME)
        return NULL_TREE;
 
-      const value_range_equiv *vr = m_vr_values->get_value_range (op);
+      const value_range *vr = m_vr_values->get_value_range (op);
       return find_case_label_range (switch_stmt, vr);
     }
   if (gassign *assign_stmt = dyn_cast <gassign *> (stmt))
index ab6aa11..0cbd9d3 100644 (file)
@@ -768,7 +768,7 @@ extract_range_from_plus_minus_expr (value_range *vr,
          value_range vrres;
          extract_range_from_plus_minus_expr (&vrres, code, expr_type,
                                              &vrtem1, vr1_);
-         vr->union_ (&vrres);
+         vr->union_ (vrres);
        }
       return;
     }
@@ -782,7 +782,7 @@ extract_range_from_plus_minus_expr (value_range *vr,
          value_range vrres;
          extract_range_from_plus_minus_expr (&vrres, code, expr_type,
                                              vr0_, &vrtem1);
-         vr->union_ (&vrres);
+         vr->union_ (vrres);
        }
       return;
     }
@@ -2470,7 +2470,7 @@ find_case_label_range (gswitch *switch_stmt, const irange *range_of_op)
       int_range_max label_range (CASE_LOW (label), case_high);
       if (!types_compatible_p (label_range.type (), range_of_op->type ()))
        range_cast (label_range, range_of_op->type ());
-      label_range.intersect (range_of_op);
+      label_range.intersect (*range_of_op);
       if (label_range == *range_of_op)
        return label;
     }
@@ -2494,7 +2494,7 @@ find_case_label_range (gswitch *switch_stmt, const irange *range_of_op)
       int_range_max label_range (CASE_LOW (min_label), case_high);
       if (!types_compatible_p (label_range.type (), range_of_op->type ()))
        range_cast (label_range, range_of_op->type ());
-      label_range.intersect (range_of_op);
+      label_range.intersect (*range_of_op);
       if (label_range.undefined_p ())
        return gimple_switch_label (switch_stmt, 0);
     }
index 731fa53..77c6f5c 100644 (file)
@@ -188,7 +188,7 @@ value_range_equiv::equiv_add (const_tree var,
 }
 
 void
-value_range_equiv::intersect (const value_range_equiv *other)
+value_range_equiv::legacy_verbose_intersect (const value_range_equiv *other)
 {
   if (dump_file && (dump_flags & TDF_DETAILS))
     {
@@ -238,7 +238,7 @@ value_range_equiv::intersect (const value_range_equiv *other)
 }
 
 void
-value_range_equiv::union_ (const value_range_equiv *other)
+value_range_equiv::legacy_verbose_union_ (const value_range_equiv *other)
 {
   if (dump_file && (dump_flags & TDF_DETAILS))
     {
index 11b806c..0aa1069 100644 (file)
@@ -48,8 +48,8 @@ class GTY((user)) value_range_equiv : public value_range
 
   bool operator== (const value_range_equiv &) const /* = delete */;
   bool operator!= (const value_range_equiv &) const /* = delete */;
-  void intersect (const value_range_equiv *);
-  void union_ (const value_range_equiv *);
+  void legacy_verbose_intersect (const value_range_equiv *);
+  void legacy_verbose_union_ (const value_range_equiv *);
   bool equal_p (const value_range_equiv &, bool ignore_equivs) const;
 
   /* Types of value ranges.  */
index 000bbcf..94301b3 100644 (file)
@@ -1442,7 +1442,7 @@ irange::legacy_union (irange *vr0, const irange *vr1)
    may not be the smallest possible such range.  */
 
 void
-irange::union_ (const irange *other)
+irange::legacy_verbose_union_ (const irange *other)
 {
   if (legacy_mode_p ())
     {
@@ -1482,7 +1482,7 @@ irange::union_ (const irange *other)
 }
 
 void
-irange::intersect (const irange *other)
+irange::legacy_verbose_intersect (const irange *other)
 {
   if (legacy_mode_p ())
     {
index b64e024..90a395f 100644 (file)
@@ -96,8 +96,8 @@ public:
   bool may_contain_p (tree) const;             // DEPRECATED
   void set (tree);                             // DEPRECATED
   bool equal_p (const irange &) const;         // DEPRECATED
-  void union_ (const class irange *);          // DEPRECATED
-  void intersect (const irange *);             // DEPRECATED
+  void legacy_verbose_union_ (const class irange *);   // DEPRECATED
+  void legacy_verbose_intersect (const irange *);      // DEPRECATED
 
 protected:
   irange (tree *, unsigned);
@@ -549,7 +549,7 @@ irange::union_ (const irange &r)
 {
   dump_flags_t m_flags = dump_flags;
   dump_flags &= ~TDF_DETAILS;
-  irange::union_ (&r);
+  irange::legacy_verbose_union_ (&r);
   dump_flags = m_flags;
 }
 
@@ -558,7 +558,7 @@ irange::intersect (const irange &r)
 {
   dump_flags_t m_flags = dump_flags;
   dump_flags &= ~TDF_DETAILS;
-  irange::intersect (&r);
+  irange::legacy_verbose_intersect (&r);
   dump_flags = m_flags;
 }
 
index 122586f..301996d 100644 (file)
@@ -266,7 +266,7 @@ vr_values::update_value_range (const_tree var, value_range_equiv *new_vr)
       value_range_equiv nr;
       get_global_range_query ()->range_of_expr (nr, const_cast <tree> (var));
       if (!nr.undefined_p ())
-       new_vr->intersect (&nr);
+       new_vr->legacy_verbose_intersect (&nr);
     }
 
   /* Update the value range, if necessary.  If we cannot allocate a lattice
@@ -750,7 +750,7 @@ vr_values::extract_range_for_var_from_comparison_expr (tree var,
     gcc_unreachable ();
 
   /* Finally intersect the new range with what we already know about var.  */
-  vr_p->intersect (get_value_range (var));
+  vr_p->legacy_verbose_intersect (get_value_range (var));
 }
 
 /* Extract value range information from an ASSERT_EXPR EXPR and store
@@ -1014,7 +1014,7 @@ vr_values::extract_range_from_cond_expr (value_range_equiv *vr, gassign *stmt)
 
   /* The resulting value range is the union of the operand ranges */
   vr->deep_copy (vr0);
-  vr->union_ (vr1);
+  vr->legacy_verbose_union_ (vr1);
 }
 
 
@@ -2300,10 +2300,10 @@ simplify_using_ranges::vrp_evaluate_conditional_warnv_with_ops
             for previously LE_ or LT_EXPR and GT_EXPR otherwise, but
             the comments next to the enclosing if suggest it's not
             generally profitable to do so.  */
-         vro.intersect (vr0);
+         vro.legacy_verbose_intersect (vr0);
          if (vro.undefined_p ())
            return boolean_false_node;
-         vri.intersect (vr0);
+         vri.legacy_verbose_intersect (vr0);
          if (vri.undefined_p ())
            return boolean_true_node;
        }
@@ -2803,7 +2803,7 @@ vr_values::extract_range_from_phi_node (gphi *phi,
          if (first)
            vr_result->deep_copy (vr_arg);
          else
-           vr_result->union_ (vr_arg);
+           vr_result->legacy_verbose_union_ (vr_arg);
          first = false;
 
          if (vr_result->varying_p ())