[COMMITTED] Convert some uses in ranger_cache and DOM to vrange.

Aldy Hernandez aldyh@redhat.com
Sun Jul 24 15:04:28 GMT 2022


Here are a few conversions to type agnostic vrange I found while
working on frange.

Tested on x86-64 Linux.

gcc/ChangeLog:

	* gimple-range-cache.cc (ranger_cache::edge_range): Convert to vrange.
	(ranger_cache::range_from_dom): Same.
	* tree-ssa-dom.cc
	(dom_opt_dom_walker::set_global_ranges_from_unreachable_edges): Same.
---
 gcc/gimple-range-cache.cc |  7 ++++---
 gcc/tree-ssa-dom.cc       | 18 ++++++++++--------
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc
index f3292fccaee..d9e160c9a2a 100644
--- a/gcc/gimple-range-cache.cc
+++ b/gcc/gimple-range-cache.cc
@@ -960,7 +960,7 @@ ranger_cache::edge_range (vrange &r, edge e, tree name, enum rfd_mode mode)
   // If this is not an abnormal edge, check for inferred ranges on exit.
   if ((e->flags & (EDGE_EH | EDGE_ABNORMAL)) == 0)
     m_exit.maybe_adjust_range (r, name, e->src);
-  int_range_max er;
+  Value_Range er (TREE_TYPE (name));
   if (m_gori.outgoing_edge_range_p (er, e, name, *this))
     r.intersect (er);
   return true;
@@ -1364,7 +1364,8 @@ ranger_cache::range_from_dom (vrange &r, tree name, basic_block start_bb,
   basic_block prev_bb = start_bb;
 
   // Track any inferred ranges seen.
-  int_range_max infer (TREE_TYPE (name));
+  Value_Range infer (TREE_TYPE (name));
+  infer.set_varying (TREE_TYPE (name));
 
   // Range on entry to the DEF block should not be queried.
   gcc_checking_assert (start_bb != def_bb);
@@ -1431,7 +1432,7 @@ ranger_cache::range_from_dom (vrange &r, tree name, basic_block start_bb,
   // Now process any blocks wit incoming edges that nay have adjustemnts.
   while (m_workback.length () > start_limit)
     {
-      int_range_max er;
+      Value_Range er (TREE_TYPE (name));
       prev_bb = m_workback.pop ();
       if (!single_pred_p (prev_bb))
 	{
diff --git a/gcc/tree-ssa-dom.cc b/gcc/tree-ssa-dom.cc
index f5e8f574997..44dc27b464c 100644
--- a/gcc/tree-ssa-dom.cc
+++ b/gcc/tree-ssa-dom.cc
@@ -1233,20 +1233,22 @@ dom_opt_dom_walker::set_global_ranges_from_unreachable_edges (basic_block bb)
 
   gimple *stmt = last_stmt (pred_e->src);
   tree name;
-  int_range_max r;
   if (stmt
       && gimple_code (stmt) == GIMPLE_COND
       && (name = gimple_cond_lhs (stmt))
       && TREE_CODE (name) == SSA_NAME
-      && r.supports_type_p (TREE_TYPE (name))
       && assert_unreachable_fallthru_edge_p (pred_e)
-      && all_uses_feed_or_dominated_by_stmt (name, stmt)
-      && m_ranger->range_on_edge (r, pred_e, name)
-      && !r.varying_p ()
-      && !r.undefined_p ())
+      && all_uses_feed_or_dominated_by_stmt (name, stmt))
     {
-      set_range_info (name, r);
-      maybe_set_nonzero_bits (pred_e, name);
+      Value_Range r (TREE_TYPE (name));
+
+      if (m_ranger->range_on_edge (r, pred_e, name)
+	  && !r.varying_p ()
+	  && !r.undefined_p ())
+	{
+	  set_range_info (name, r);
+	  maybe_set_nonzero_bits (pred_e, name);
+	}
     }
 }
 
-- 
2.36.1



More information about the Gcc-patches mailing list