public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] backthreader dump fix
Date: Fri, 5 Aug 2022 14:31:56 +0200 (CEST)	[thread overview]
Message-ID: <20220805123156.8F62313A9C@imap2.suse-dmz.suse.de> (raw)

This fixes odd SUCCEEDED dumps from the backthreader registry that
can happen even though register_jump_thread cancelled the thread
as invalid.

Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.

	* tree-ssa-threadbackward.cc (back_threader::maybe_register_path):
	Check whether the registry register_path rejected the path.
	(back_threader_registry::register_path): Return whether
	register_jump_thread succeeded.
---
 gcc/tree-ssa-threadbackward.cc | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/gcc/tree-ssa-threadbackward.cc b/gcc/tree-ssa-threadbackward.cc
index 3acd66a7780..332a1d2a1dd 100644
--- a/gcc/tree-ssa-threadbackward.cc
+++ b/gcc/tree-ssa-threadbackward.cc
@@ -243,10 +243,9 @@ back_threader::maybe_register_path ()
 	  bool irreducible = false;
 	  if (m_profit.profitable_path_p (m_path, m_name, taken_edge,
 					  &irreducible)
-	      && debug_counter ())
+	      && debug_counter ()
+	      && m_registry.register_path (m_path, taken_edge))
 	    {
-	      m_registry.register_path (m_path, taken_edge);
-
 	      if (irreducible)
 		vect_free_loop_info_assumptions (m_path[0]->loop_father);
 	    }
@@ -858,8 +857,7 @@ back_threader_registry::register_path (const vec<basic_block> &m_path,
     }
 
   push_edge (jump_thread_path, taken_edge, EDGE_NO_COPY_SRC_BLOCK);
-  register_jump_thread (jump_thread_path);
-  return true;
+  return register_jump_thread (jump_thread_path);
 }
 
 // Thread all suitable paths in the current function.
-- 
2.35.3

             reply	other threads:[~2022-08-05 12:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-05 12:31 Richard Biener [this message]
2022-08-05 15:27 ` Jeff Law

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=20220805123156.8F62313A9C@imap2.suse-dmz.suse.de \
    --to=rguenther@suse.de \
    --cc=gcc-patches@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).