public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-2342] Remove cycle checking from compute_control_dep_chain
@ 2022-09-01 13:07 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2022-09-01 13:07 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:47e15513c9e581ef04ad25fb0d561a45d345edd1

commit r13-2342-g47e15513c9e581ef04ad25fb0d561a45d345edd1
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Sep 1 13:28:08 2022 +0200

    Remove cycle checking from compute_control_dep_chain
    
    Now that we have DFS_BACK_EDGE marks we can simply avoid walking
    those instead of repeatedly looking for a cycle on the current chain.
    
            * gimple-predicate-analysis.cc (compute_control_dep_chain):
            Remove cycle detection, instead avoid walking backedges.

Diff:
---
 gcc/gimple-predicate-analysis.cc | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/gcc/gimple-predicate-analysis.cc b/gcc/gimple-predicate-analysis.cc
index 2982268fdfd..a754ff0a029 100644
--- a/gcc/gimple-predicate-analysis.cc
+++ b/gcc/gimple-predicate-analysis.cc
@@ -1035,18 +1035,6 @@ compute_control_dep_chain (basic_block dom_bb, const_basic_block dep_bb,
 	fprintf (dump_file, "chain length exceeds 5: %u\n", cur_chain_len);
     }
 
-  for (unsigned i = 0; i < cur_chain_len; i++)
-    {
-      edge e = cur_cd_chain[i];
-      /* Cycle detected.  */
-      if (e->src == dom_bb)
-	{
-	  if (dump_file)
-	    fprintf (dump_file, "cycle detected\n");
-	  return false;
-	}
-    }
-
   if (DEBUG_PREDICATE_ANALYZER && dump_file)
     fprintf (dump_file,
 	     "%*s%s (dom_bb = %u, dep_bb = %u, cd_chains = { %s }, ...)\n",
@@ -1061,7 +1049,7 @@ compute_control_dep_chain (basic_block dom_bb, const_basic_block dep_bb,
   FOR_EACH_EDGE (e, ei, dom_bb->succs)
     {
       int post_dom_check = 0;
-      if (e->flags & (EDGE_FAKE | EDGE_ABNORMAL))
+      if (e->flags & (EDGE_FAKE | EDGE_ABNORMAL | EDGE_DFS_BACK))
 	continue;
 
       basic_block cd_bb = e->dest;
@@ -1110,6 +1098,12 @@ compute_control_dep_chain (basic_block dom_bb, const_basic_block dep_bb,
 	      break;
 	    }
 
+	  /* The post-dominator walk will reach a backedge only
+	     from a forwarder, otherwise it should choose to exit
+	     the SCC.  */
+	  if (single_succ_p (cd_bb)
+	      && single_succ_edge (cd_bb)->flags & EDGE_DFS_BACK)
+	    break;
 	  cd_bb = get_immediate_dominator (CDI_POST_DOMINATORS, cd_bb);
 	  post_dom_check++;
 	  if (cd_bb == EXIT_BLOCK_PTR_FOR_FN (cfun)

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

only message in thread, other threads:[~2022-09-01 13:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-01 13:07 [gcc r13-2342] Remove cycle checking from compute_control_dep_chain Richard Biener

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