public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-1759] Resolve complicated join nodes in range_from_dom.
@ 2022-07-19 22:10 Andrew Macleod
  0 siblings, 0 replies; only message in thread
From: Andrew Macleod @ 2022-07-19 22:10 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:dbb093f4f15ea66f2ce5cd2dc1903a6894563356

commit r13-1759-gdbb093f4f15ea66f2ce5cd2dc1903a6894563356
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Mon Jul 18 15:04:23 2022 -0400

    Resolve complicated join nodes in range_from_dom.
    
    Join nodes which carry outgoing ranges on incoming edges are uncommon,
    but can still be resolved by setting the dominator range, and then
    calculating incoming edges.  Avoid doing so if one of the incoing edges
    is not dominated by the same dominator.
    
            * gimple-range-cache.cc (ranger_cache::range_from_dom): Check
              for incoming ranges on join nodes and add to worklist.

Diff:
---
 gcc/gimple-range-cache.cc | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc
index 20dd5ead3bc..f3292fccaee 100644
--- a/gcc/gimple-range-cache.cc
+++ b/gcc/gimple-range-cache.cc
@@ -1384,6 +1384,32 @@ ranger_cache::range_from_dom (vrange &r, tree name, basic_block start_bb,
       // This block has an outgoing range.
       if (m_gori.has_edge_range_p (name, bb))
 	m_workback.quick_push (prev_bb);
+      else
+	{
+	  // Normally join blocks don't carry any new range information on
+	  // incoming edges.  If the first incoming edge to this block does
+	  // generate a range, calculate the ranges if all incoming edges
+	  // are also dominated by the dominator.  (Avoids backedges which
+	  // will break the rule of moving only upward in the domniator tree).
+	  // If the first pred does not generate a range, then we will be
+	  // using the dominator range anyway, so thats all the check needed.
+	  if (EDGE_COUNT (prev_bb->preds) > 1
+	      && m_gori.has_edge_range_p (name, EDGE_PRED (prev_bb, 0)->src))
+	    {
+	      edge e;
+	      edge_iterator ei;
+	      bool all_dom = true;
+	      FOR_EACH_EDGE (e, ei, prev_bb->preds)
+		if (e->src != bb
+		    && !dominated_by_p (CDI_DOMINATORS, e->src, bb))
+		  {
+		    all_dom = false;
+		    break;
+		  }
+	      if (all_dom)
+		m_workback.quick_push (prev_bb);
+	    }
+	}
 
       if (def_bb == bb)
 	break;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-19 22:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-19 22:10 [gcc r13-1759] Resolve complicated join nodes in range_from_dom Andrew Macleod

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).