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-1924] tree-optimization/106495 - avoid threading to possibly never executed edge
Date: Tue,  2 Aug 2022 06:35:30 +0000 (GMT)	[thread overview]
Message-ID: <20220802063530.861093853828@sourceware.org> (raw)

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

commit r13-1924-gb9da686470d1c23929eefb401280ad8ba17e2a58
Author: Richard Biener <rguenther@suse.de>
Date:   Mon Aug 1 14:59:08 2022 +0200

    tree-optimization/106495 - avoid threading to possibly never executed edge
    
    The following builds upon the logic of the PR105679 fix by avoiding
    to thread to a known edge that is predicted as probably never executed.
    
            PR tree-optimization/106495
            * tree-ssa-threadbackward.cc
            (back_threader_profitability::profitable_path_p): If known_edge
            is probably never executed avoid threading.

Diff:
---
 gcc/tree-ssa-threadbackward.cc | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gcc/tree-ssa-threadbackward.cc b/gcc/tree-ssa-threadbackward.cc
index 90f5331c265..0519f2a8c4b 100644
--- a/gcc/tree-ssa-threadbackward.cc
+++ b/gcc/tree-ssa-threadbackward.cc
@@ -777,6 +777,13 @@ back_threader_profitability::profitable_path_p (const vec<basic_block> &m_path,
 		     "exceeds PARAM_MAX_FSM_THREAD_PATH_INSNS.\n");
 	  return false;
 	}
+      if (taken_edge && probably_never_executed_edge_p (cfun, taken_edge))
+	{
+	  if (dump_file && (dump_flags & TDF_DETAILS))
+	    fprintf (dump_file, "  FAIL: Jump-thread path not considered: "
+		     "path leads to probably never executed edge.\n");
+	  return false;
+	}
       edge entry = find_edge (m_path[m_path.length () - 1],
 			      m_path[m_path.length () - 2]);
       if (probably_never_executed_edge_p (cfun, entry))


                 reply	other threads:[~2022-08-02  6:35 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=20220802063530.861093853828@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).