public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [COMMITTED] path solver: Use range_on_path_entry instead of looking at equivalences.
@ 2021-09-22 11:32 Aldy Hernandez
  2021-09-22 11:32 ` [COMMITTED] Check for BB before calling register_outgoing_edges Aldy Hernandez
  0 siblings, 1 reply; 2+ messages in thread
From: Aldy Hernandez @ 2021-09-22 11:32 UTC (permalink / raw)
  To: Andrew MacLeod; +Cc: GCC patches, Aldy Hernandez

[Thanks for spotting this Andrew.]

Cycling through equivalences to improve a range is nowhere near as
efficient as asking the ranger what the range on entry is.

Testing on a hybrid VRP threader, shows that this improves our VRP
threading benefit from 14.5% to 18.5% and our overall jump threads from
0.85% to 1.28%.

Tested on x86-64 Linux.

gcc/ChangeLog:

	* gimple-range-path.cc (path_range_query::internal_range_of_expr):
	Remove call to improve_range_with_equivs.
	(path_range_query::improve_range_with_equivs): Remove
	* gimple-range-path.h: Remove improve_range_with_equivs.
---
 gcc/gimple-range-path.cc | 33 +--------------------------------
 gcc/gimple-range-path.h  |  1 -
 2 files changed, 1 insertion(+), 33 deletions(-)

diff --git a/gcc/gimple-range-path.cc b/gcc/gimple-range-path.cc
index e65c7996bb7..d052ebd81fc 100644
--- a/gcc/gimple-range-path.cc
+++ b/gcc/gimple-range-path.cc
@@ -163,10 +163,6 @@ path_range_query::internal_range_of_expr (irange &r, tree name, gimple *stmt)
   if (m_resolve && defined_outside_path (name))
     {
       range_on_path_entry (r, name);
-
-      if (r.varying_p ())
-	improve_range_with_equivs (r, name);
-
       set_cache (r, name);
       return true;
     }
@@ -178,7 +174,7 @@ path_range_query::internal_range_of_expr (irange &r, tree name, gimple *stmt)
 	r.intersect (gimple_range_global (name));
 
       if (m_resolve && r.varying_p ())
-	improve_range_with_equivs (r, name);
+	range_on_path_entry (r, name);
 
       set_cache (r, name);
       return true;
@@ -201,33 +197,6 @@ path_range_query::range_of_expr (irange &r, tree name, gimple *stmt)
   return false;
 }
 
-// Improve the range of NAME with the range of any of its equivalences.
-
-void
-path_range_query::improve_range_with_equivs (irange &r, tree name)
-{
-  if (TREE_CODE (name) != SSA_NAME)
-    return;
-
-  basic_block entry = entry_bb ();
-  relation_oracle *oracle = m_ranger.oracle ();
-
-  if (const bitmap_head *equivs = oracle->equiv_set (name, entry))
-    {
-      int_range_max t;
-      bitmap_iterator bi;
-      unsigned i;
-
-      EXECUTE_IF_SET_IN_BITMAP (equivs, 0, i, bi)
-	if (i != SSA_NAME_VERSION (name) && r.varying_p ())
-	  {
-	    tree equiv = ssa_name (i);
-	    range_on_path_entry (t, equiv);
-	    r.intersect (t);
-	  }
-    }
-}
-
 bool
 path_range_query::unreachable_path_p ()
 {
diff --git a/gcc/gimple-range-path.h b/gcc/gimple-range-path.h
index 6f81f21d42f..f7d9832ac8c 100644
--- a/gcc/gimple-range-path.h
+++ b/gcc/gimple-range-path.h
@@ -63,7 +63,6 @@ private:
   void ssa_range_in_phi (irange &r, gphi *phi);
   void precompute_relations (const vec<basic_block> &);
   void precompute_phi_relations (basic_block bb, basic_block prev);
-  void improve_range_with_equivs (irange &r, tree name);
   void add_copies_to_imports ();
   bool add_to_imports (tree name, bitmap imports);
 
-- 
2.31.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [COMMITTED] Check for BB before calling register_outgoing_edges.
  2021-09-22 11:32 [COMMITTED] path solver: Use range_on_path_entry instead of looking at equivalences Aldy Hernandez
@ 2021-09-22 11:32 ` Aldy Hernandez
  0 siblings, 0 replies; 2+ messages in thread
From: Aldy Hernandez @ 2021-09-22 11:32 UTC (permalink / raw)
  To: Andrew MacLeod; +Cc: GCC patches, Aldy Hernandez

We may be asked to fold an artificial statement not in the CFG.  Since
there are no outgoing edges from those, avoid calling
register_outgoing_edges.

Tested on x86-64 Linux.

gcc/ChangeLog:

	* gimple-range-fold.cc (fold_using_range::range_of_range_op):
	Move check for non-empty BB here.
	(fur_source::register_outgoing_edges): ...from here.
---
 gcc/gimple-range-fold.cc | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/gcc/gimple-range-fold.cc b/gcc/gimple-range-fold.cc
index d7fa0f2c86e..1da1befa9a2 100644
--- a/gcc/gimple-range-fold.cc
+++ b/gcc/gimple-range-fold.cc
@@ -650,7 +650,9 @@ fold_using_range::range_of_range_op (irange &r, gimple *s, fur_source &src)
 		    src.register_relation (s, rel, lhs, op2);
 		}
 	    }
-	  else if (is_a<gcond *> (s))
+	  // Check for an existing BB, as we maybe asked to fold an
+	  // artificial statement not in the CFG.
+	  else if (is_a<gcond *> (s) && gimple_bb (s))
 	    {
 	      basic_block bb = gimple_bb (s);
 	      edge e0 = EDGE_SUCC (bb, 0);
@@ -1404,10 +1406,6 @@ fur_source::register_outgoing_edges (gcond *s, irange &lhs_range, edge e0, edge
   range_operator *handler;
   basic_block bb = gimple_bb (s);
 
-  // We may get asked to fold an artificial statement not in the CFG.
-  if (!bb)
-    return;
-
   if (e0)
     {
       // If this edge is never taken, ignore it.
-- 
2.31.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-22 11:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-22 11:32 [COMMITTED] path solver: Use range_on_path_entry instead of looking at equivalences Aldy Hernandez
2021-09-22 11:32 ` [COMMITTED] Check for BB before calling register_outgoing_edges Aldy Hernandez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).