public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Richard Biener <rguenth@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-2342] Remove cycle checking from compute_control_dep_chain
Date: Thu,  1 Sep 2022 13:07:44 +0000 (GMT)	[thread overview]
Message-ID: <20220901130744.4A4F2385828D@sourceware.org> (raw)

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)

                 reply	other threads:[~2022-09-01 13:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220901130744.4A4F2385828D@sourceware.org \
    --to=rguenth@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).