[gcc/devel/ranger] Remove use of assert_info in favor of using GORI's export list.

Aldy Hernandez aldyh@gcc.gnu.org
Thu Mar 5 10:21:00 GMT 2020


https://gcc.gnu.org/g:775488eb558b051f61c1c32256b17de5af3e3301

commit 775488eb558b051f61c1c32256b17de5af3e3301
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Mon Mar 2 16:55:18 2020 +0100

    Remove use of assert_info in favor of using GORI's export list.

Diff:
---
 gcc/gimple-range-gori.h       |  2 ++
 gcc/gimple-ssa-evrp-analyze.c | 28 +++++-----------------
 gcc/gimple-ssa-evrp-analyze.h |  2 --
 gcc/vr-values.c               | 55 ++++---------------------------------------
 gcc/vr-values.h               | 14 -----------
 5 files changed, 13 insertions(+), 88 deletions(-)

diff --git a/gcc/gimple-range-gori.h b/gcc/gimple-range-gori.h
index 4850647..2c76cf1 100644
--- a/gcc/gimple-range-gori.h
+++ b/gcc/gimple-range-gori.h
@@ -128,6 +128,8 @@ private:
   void maybe_add_gori (tree name, basic_block bb);
   void calculate_gori (basic_block bb);
   bitmap imports (basic_block bb);
+public:
+  // FIXME: Temporarily set as public.
   bitmap exports (basic_block bb);
 };
 
diff --git a/gcc/gimple-ssa-evrp-analyze.c b/gcc/gimple-ssa-evrp-analyze.c
index 48780fc..36da9e8 100644
--- a/gcc/gimple-ssa-evrp-analyze.c
+++ b/gcc/gimple-ssa-evrp-analyze.c
@@ -215,26 +215,6 @@ evrp_range_analyzer::merge_gori_and_evrp_results
   return vr;
 }
 
-void
-evrp_range_analyzer::try_find_new_range_with_gori
-				(irange &res, tree name, edge e,
-				 const vec<assert_info> &asserts)
-{
-  if (!vr_values->gori_computable_p (name, e->src))
-    return;
-
-  const value_range_equiv *known_range = get_value_range (name);
-  // ?? Perhaps it's worth calling normalize_addresses here?
-  if (known_range && !range_has_numeric_bounds_p (known_range))
-    known_range = NULL;
-  equivalence_iterator iter (name, known_range, asserts);
-  vr_values->save_equivalences (&iter);
-
-  if (vr_values->outgoing_edge_range_p (res, e, name))
-    return;
-  res.set_varying (TREE_TYPE (name));
-}
-
 static void
 dump_gori_improvements (tree name, const irange *r_evrp, const irange *r_gori)
 {
@@ -385,8 +365,12 @@ evrp_range_analyzer::record_ranges_from_incoming_edge (basic_block bb)
 		   && vr_values->gori_computable_p (asserts[i].name,
 						    pred_e->src));
 	      if (gori_can_calculate)
-		try_find_new_range_with_gori (vr_gori, asserts[i].name,
-					      pred_e, asserts);
+		{
+		  if (!vr_values->outgoing_edge_range_p (vr_gori,
+							 pred_e,
+							 asserts[i].name))
+		    vr_gori.set_varying (TREE_TYPE (asserts[i].name));
+		}
 	      value_range_equiv *vr
 		= try_find_new_range (asserts[i].name,
 				      asserts[i].expr,
diff --git a/gcc/gimple-ssa-evrp-analyze.h b/gcc/gimple-ssa-evrp-analyze.h
index 06714ad..63db895 100644
--- a/gcc/gimple-ssa-evrp-analyze.h
+++ b/gcc/gimple-ssa-evrp-analyze.h
@@ -70,8 +70,6 @@ class evrp_range_analyzer
   void set_ssa_range_info (tree, value_range_equiv *);
 
   /* GORI support.  */
-  void try_find_new_range_with_gori (irange &, tree, edge,
-				     const vec<assert_info> &);
   void assert_gori_is_as_good (tree, edge,
 			       const irange *,
 			       const irange *,
diff --git a/gcc/vr-values.c b/gcc/vr-values.c
index 17a6d34..29339c3 100644
--- a/gcc/vr-values.c
+++ b/gcc/vr-values.c
@@ -1948,46 +1948,6 @@ vr_values::dump_all_value_ranges (FILE *file)
     }
 }
 
-// Register any SSA_NAMEs that may help us determine a range for NAME.
-// The union of all these for a block is conceptually what the GORI
-// exports table is.  At some point, we should remove this and just
-// look at the GORI exports-- or trap when any of these SSA_NAMEs is
-// not in the GORI export table.
-
-equivalence_iterator::equivalence_iterator (tree name,
-					    const value_range_equiv *vr,
-					    const vec<assert_info> &asserts)
-{
-  // ?? Copy known equivalences, though I'm not convinced adding these
-  // makes any difference.
-  m_bitmap = BITMAP_ALLOC (NULL);
-  if (vr && vr->equiv ())
-    bitmap_copy (m_bitmap, vr->equiv ());
-
-  // Add in the assert relationships as equivalences.
-  for (unsigned i = 0; i < asserts.length (); ++i)
-    {
-      tree assert_name = asserts[i].name;
-      bitmap_set_bit (m_bitmap, SSA_NAME_VERSION (assert_name));
-    }
-
-  m_index = 0;
-  bitmap_clear_bit (m_bitmap, SSA_NAME_VERSION (name));
-  bmp_iter_set_init (&m_bitmap_iter, m_bitmap, 0, &m_index);
-}
-
-tree
-equivalence_iterator::next (void)
-{
-  if (bmp_iter_set (&m_bitmap_iter, &m_index))
-    {
-      tree equiv = ssa_name (m_index);
-      bmp_iter_next (&m_bitmap_iter, &m_index);
-      return equiv;
-    }
-  return NULL;
-}
-
 void
 vr_values::range_of_ssa_name (irange &r, tree op,
 			      gimple *stmt ATTRIBUTE_UNUSED)
@@ -1996,12 +1956,6 @@ vr_values::range_of_ssa_name (irange &r, tree op,
   r.normalize_symbolics ();
 }
 
-void
-vr_gori_interface::save_equivalences (equivalence_iterator *iter)
-{
-  m_equivalences = iter;
-}
-
 // Return TRUE if NAME is computable by GORI in BB.
 
 bool
@@ -2042,11 +1996,12 @@ vr_gori_interface::refine_range_with_equivalences_p (irange &r,
     r.intersect (tmp);
 
   // Solve each equivalence and use them to refine the range.
-  tree equiv;
-  while ((equiv = m_equivalences->next ()) != NULL)
+  bitmap_iterator bi;
+  unsigned i;
+  bitmap gori_exports = m_gori_map.exports (e->src);
+  EXECUTE_IF_SET_IN_BITMAP (gori_exports, 0, i, bi)
     {
-      if (!m_gori_map.is_export_p (equiv, e->src))
-	continue;
+      tree equiv = ssa_name (i);
 
       widest_irange equiv_range;
       if (solve_name_at_statement (equiv_range, equiv, branch, branch_range))
diff --git a/gcc/vr-values.h b/gcc/vr-values.h
index 7409efe..61ad1fe 100644
--- a/gcc/vr-values.h
+++ b/gcc/vr-values.h
@@ -22,25 +22,12 @@ along with GCC; see the file COPYING3.  If not see
 
 #include "gimple-range-gori.h"
 
-class equivalence_iterator
-{
-public:
-  equivalence_iterator (tree name, const value_range_equiv *,
-			const vec<assert_info> &);
-  tree next (void);
-private:
-  bitmap m_bitmap;
-  bitmap_iterator m_bitmap_iter;
-  unsigned int m_index;
-};
-
 class vr_gori_interface : public gori_compute
 {
 public:
   virtual bool outgoing_edge_range_p (irange &, edge, tree name,
 				      const irange *name_range = NULL);
   bool gori_computable_p (tree name, basic_block);
-  void save_equivalences (equivalence_iterator *);
 private:
   virtual void range_of_ssa_name (irange &r ATTRIBUTE_UNUSED,
 				  tree op ATTRIBUTE_UNUSED,
@@ -50,7 +37,6 @@ private:
   bool solve_name_at_statement (irange &, tree, gimple *stmt, const irange &);
   bool solve_name_given_equivalence (irange &r, tree name, tree equiv,
 				     const irange &equiv_range);
-  equivalence_iterator *m_equivalences;
 };
 
 /* The VR_VALUES class holds the current view of range information



More information about the Gcc-cvs mailing list