]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Rename value_range::set_type to value_range::set_range_class
authorDavid Malcolm <dmalcolm@redhat.com>
Thu, 5 Feb 2026 00:04:52 +0000 (19:04 -0500)
committerAndrew MacLeod <amacleod@redhat.com>
Mon, 4 May 2026 15:48:02 +0000 (11:48 -0400)
value_range::set_type doesn't set the m_type of the underlying
vrange; it merely sets m_vrange to use an appropriate vrange
subclass for the given type.

This confused me.  This patch renames it to avoid other people being
similarly confused.

No functional change intended.

gcc/
* data-streamer-in.cc (streamer_read_value_range): Update for
renaming of value_range::set_type to value_range::set_range_class.
* gimple-range-gori.cc (gori_compute::compute_operand_range):
Likewise.
(gori_compute::compute_operand1_and_operand2_range): Likewise.
(gori_stmt_info::gori_stmt_info): Likewise.
(gori_calc_operands): Likewise.
(gori_name_helper): Likewise.
* ipa-cp.cc (ipcp_vr_lattice::set_to_bottom): Likewise.
* ipa-cp.h (ipcp_vr_lattice::init): Likewise.
* ipa-fnsummary.cc (evaluate_properties_for_edge): Likewise.
* ipa-prop.cc (ipa_vr::get_vrange): Likewise.
* range-op.h (range_cast): Likewise.
* value-range.h (value_range::set_type): Rename to...
(value_range::set_range_class): ...this, and add a note to the
leading comment that it doesn't set the type of the underlying
vrange.
(value_range::init): Add a similar note to the leading comment.
gcc/analyzer/
* svalue.cc (binop_svalue::maybe_get_value_range): Update for
renaming of value_range::set_type to value_range::set_range_class.
(unaryop_svalue::maybe_get_value_range): Likewise.

gcc/analyzer/svalue.cc
gcc/data-streamer-in.cc
gcc/gimple-range-gori.cc
gcc/ipa-cp.cc
gcc/ipa-cp.h
gcc/ipa-fnsummary.cc
gcc/ipa-prop.cc
gcc/range-op.h
gcc/value-range.h

index 824da5df793f85580ca277c8b215d3a56d650074..fe22ae73dddaa9de09e637e97ec18ce9c935a6a6 100644 (file)
@@ -1594,7 +1594,7 @@ unaryop_svalue::maybe_get_value_range_1 (value_range &out) const
             a VARYING of the unknown value as the 2nd operand.  */
          value_range varying (type);
          varying.set_varying (type);
-         out.set_type (type);
+         out.set_range_class (type);
          if (handler.fold_range (out, type, arg_vr, varying))
            return true;
        }
@@ -1742,7 +1742,7 @@ binop_svalue::maybe_get_value_range_1 (value_range &out) const
        range_op_handler handler (m_op);
        if (handler)
          {
-           out.set_type (type);
+           out.set_range_class (type);
            if (handler.fold_range (out, get_type (), lhs, rhs))
              return true;
          }
index f2294260b5a6d7e9cc857115e7edd08d56cbd00d..a4c2b0b6ba3cfb9f59b0aecaabe91ca359e647f6 100644 (file)
@@ -223,7 +223,7 @@ streamer_read_value_range (class lto_input_block *ib, data_in *data_in,
   tree type = stream_read_tree (ib, data_in);
 
   // Initialize the value_range to the correct type.
-  vr.set_type (type);
+  vr.set_range_class (type);
 
   if (is_a <irange> (vr))
     {
index 1c0a2b9f7978a61247daef6f24bb371500cb82f3..939798c9d7195fb69eea49400ee14813d7971b6c 100644 (file)
@@ -772,7 +772,7 @@ gori_compute::compute_operand_range (vrange &r, gimple *stmt,
   gimple *src_stmt;
   if (op1_in_chain)
     {
-      vr.set_type (TREE_TYPE (op1));
+      vr.set_range_class (TREE_TYPE (op1));
       if (!compute_operand1_range (vr, handler, lhs, src, vrel_ptr))
        return false;
       src_stmt = SSA_NAME_DEF_STMT (op1);
@@ -780,7 +780,7 @@ gori_compute::compute_operand_range (vrange &r, gimple *stmt,
   else
     {
       gcc_checking_assert (op2_in_chain);
-      vr.set_type (TREE_TYPE (op2));
+      vr.set_range_class (TREE_TYPE (op2));
       if (!compute_operand2_range (vr, handler, lhs, src, vrel_ptr))
        return false;
       src_stmt = SSA_NAME_DEF_STMT (op2);
@@ -1318,7 +1318,7 @@ gori_compute::compute_operand1_and_operand2_range (vrange &r,
     return false;
 
   // Now get the range thru op1.
-  vr.set_type (TREE_TYPE (handler.operand1 ()));
+  vr.set_range_class (TREE_TYPE (handler.operand1 ()));
   if (!compute_operand1_range (vr, handler, lhs, src, rel))
     return false;
   src_stmt = SSA_NAME_DEF_STMT (handler.operand1 ());
@@ -1592,14 +1592,14 @@ gori_stmt_info::gori_stmt_info (vrange &lhs, gimple *stmt, range_query *q)
   fur_stmt src (stmt, q);
   if (op1)
     {
-      op1_range.set_type (TREE_TYPE (op1));
+      op1_range.set_range_class (TREE_TYPE (op1));
       src.get_operand (op1_range, op1);
     }
 
   // And satisfy the second operand for single op satements.
   if (op2)
     {
-      op2_range.set_type (TREE_TYPE (op2));
+      op2_range.set_range_class (TREE_TYPE (op2));
       src.get_operand (op2_range, op2);
     }
   else if (op1)
@@ -1625,7 +1625,7 @@ gori_calc_operands (vrange &lhs, gimple *stmt, ssa_cache &r, range_query *q)
   // If there was already a range, leave it and do no further evaluation.
   if (si.ssa1 && !r.has_range (si.ssa1))
     {
-      tmp.set_type (TREE_TYPE (si.ssa1));
+      tmp.set_range_class (TREE_TYPE (si.ssa1));
       if (si.calc_op1 (tmp, lhs, si.op2_range))
        si.op1_range.intersect (tmp);
       if (!si.op1_range.varying_p ())
@@ -1640,7 +1640,7 @@ gori_calc_operands (vrange &lhs, gimple *stmt, ssa_cache &r, range_query *q)
 
   if (si.ssa2 && !r.has_range (si.ssa2))
     {
-      tmp.set_type (TREE_TYPE (si.ssa2));
+      tmp.set_range_class (TREE_TYPE (si.ssa2));
       if (si.calc_op2 (tmp, lhs, si.op1_range))
        si.op2_range.intersect (tmp);
       if (!si.op2_range.varying_p ())
@@ -1697,7 +1697,7 @@ gori_name_helper (vrange &r, tree name, vrange &lhs, gimple *stmt,
   // If there was already a range, leave it and do no further evaluation.
   if (si.ssa1)
     {
-      tmp.set_type (TREE_TYPE (si.ssa1));
+      tmp.set_range_class (TREE_TYPE (si.ssa1));
       if (si.calc_op1 (tmp, lhs, si.op2_range))
        si.op1_range.intersect (tmp);
       gimple *src = SSA_NAME_DEF_STMT (si.ssa1);
@@ -1709,7 +1709,7 @@ gori_name_helper (vrange &r, tree name, vrange &lhs, gimple *stmt,
 
   if (si.ssa2)
     {
-      tmp.set_type (TREE_TYPE (si.ssa2));
+      tmp.set_range_class (TREE_TYPE (si.ssa2));
       if (si.calc_op2 (tmp, lhs, si.op1_range))
        si.op2_range.intersect (tmp);
       gimple *src = SSA_NAME_DEF_STMT (si.ssa2);
index 337fca7101367e017eaff7408187b961f20a4cbd..c1b1f6201fd3db7fd10832d84ea466e7c464bff4 100644 (file)
@@ -891,7 +891,7 @@ ipcp_vr_lattice::set_to_bottom ()
      but nothing else (union, intersect, etc).  This allows us to set
      bottoms on any ranges, and is safe as all users of the lattice
      check for bottom first.  */
-  m_vr.set_type (void_type_node);
+  m_vr.set_range_class (void_type_node);
   m_vr.set_varying (void_type_node);
 
   return true;
index 8191aac5c5b4dce62000d146d4c636ac883569b1..af1fe8f1e75f554f479fdfd632a353313c28f0aa 100644 (file)
@@ -261,7 +261,7 @@ inline void
 ipcp_vr_lattice::init (tree type)
 {
   if (type)
-    m_vr.set_type (type);
+    m_vr.set_range_class (type);
 
   // Otherwise m_vr will default to unsupported_range.
   m_recipient_only = false;
index e187231dfb64c6eadb226a7c8de03dac6ac94865..ff1811130785c6b0c8e0da5149664bf44993617a 100644 (file)
@@ -693,7 +693,8 @@ evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p,
                            avals->m_known_value_ranges.safe_grow_cleared (count,
                                                                           true);
                            for (int i = 0; i < count; ++i)
-                             avals->m_known_value_ranges[i].set_type (void_type_node);
+                             avals->m_known_value_ranges[i].set_range_class
+                               (void_type_node);
                          }
                        avals->m_known_value_ranges[i] = vr;
                      }
index cb89934ee38557d6e1a52a431d57a7ac62ced95f..6675c2191fcc7da1aa1fc837b008111a0fa18bcf 100644 (file)
@@ -177,7 +177,7 @@ ipa_vr::equal_p (const ipa_vr &o) const
 void
 ipa_vr::get_vrange (value_range &r) const
 {
-  r.set_type (m_type);
+  r.set_range_class (m_type);
   m_storage->get_vrange (r, m_type);
 }
 
index 5b80583e02c25640ef03c9ad7f4e8733dcd3cafe..1fd84ca07131660277f64af0100567959ccd68c8 100644 (file)
@@ -370,7 +370,7 @@ range_cast (value_range &r, tree type)
   varying.set_varying (type);
 
   // Ensure we are in the correct mode for the call to fold.
-  r.set_type (type);
+  r.set_range_class (type);
 
   // Call op_convert, if it fails, the result is varying.
   if (!range_op_handler (CONVERT_EXPR).fold_range (r, type, tmp, varying))
index cb8e7fe2f26765402588432613ec3bcc3cc1b7d2..d59c4283caaea70a4f56e7f56bf0a48d9a17ccfc 100644 (file)
@@ -767,13 +767,13 @@ public:
 //
 // Using any of the various constructors initializes the object
 // appropriately, but the default constructor is uninitialized and
-// must be initialized either with set_type() or by assigning into it.
+// must be initialized either with set_range_class() or by assigning into /it.
 //
 // Assigning between incompatible types is allowed.  For example if a
 // temporary holds an irange, you can assign an frange into it, and
 // all the right things will happen.  However, before passing this
 // object to a function accepting a vrange, the correct type must be
-// set.  If it isn't, you can do so with set_type().
+// set.  If it isn't, you can do so with set_range_class().
 
 class value_range
 {
@@ -784,7 +784,7 @@ public:
   value_range (tree, tree, value_range_kind kind = VR_RANGE);
   value_range (const value_range &);
   ~value_range ();
-  void set_type (tree type);
+  void set_range_class (tree type);
   vrange& operator= (const vrange &);
   value_range& operator= (const value_range &);
   bool operator== (const value_range &r) const;
@@ -832,7 +832,7 @@ private:
 };
 
 // The default constructor is uninitialized and must be initialized
-// with either set_type() or with an assignment into it.
+// with either set_range_class() or with an assignment into it.
 
 inline
 value_range::value_range ()
@@ -885,9 +885,10 @@ value_range::~value_range ()
 
 // Initialize object to an UNDEFINED range that can hold ranges of
 // TYPE.  Clean-up memory if there was a previous object.
+// Note that this does *not* set the type of the underlying vrange.
 
 inline void
-value_range::set_type (tree type)
+value_range::set_range_class (tree type)
 {
   if (m_vrange)
     m_vrange->~vrange ();
@@ -896,6 +897,7 @@ value_range::set_type (tree type)
 
 // Initialize object to an UNDEFINED range that can hold ranges of
 // TYPE.
+// Note that this does *not* set the type of the underlying vrange.
 
 inline void
 value_range::init (tree type)