public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] tree-optimization/106495 - avoid threading to possibly never executed edge
@ 2022-08-01 13:59 Richard Biener
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2022-08-01 13:59 UTC (permalink / raw)
  To: gcc-patches

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.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

	PR tree-optimization/106495
	* tree-ssa-threadbackward.cc
	(back_threader_profitability::profitable_path_p): If known_edge
	is probably never executed avoid threading.
---
 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))
-- 
2.35.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] tree-optimization/106495 - avoid threading to possibly never executed edge
@ 2022-08-01 13:59 Richard Biener
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2022-08-01 13:59 UTC (permalink / raw)
  To: gcc-patches

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.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

	PR tree-optimization/106495
	* tree-ssa-threadbackward.cc
	(back_threader_profitability::profitable_path_p): If known_edge
	is probably never executed avoid threading.
---
 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))
-- 
2.35.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] tree-optimization/106495 - avoid threading to possibly never executed edge
@ 2022-08-01 13:59 Richard Biener
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2022-08-01 13:59 UTC (permalink / raw)
  To: gcc-patches

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.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

	PR tree-optimization/106495
	* tree-ssa-threadbackward.cc
	(back_threader_profitability::profitable_path_p): If known_edge
	is probably never executed avoid threading.
---
 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))
-- 
2.35.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-01 13:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-01 13:59 [PATCH] tree-optimization/106495 - avoid threading to possibly never executed edge Richard Biener
  -- strict thread matches above, loose matches on Subject: below --
2022-08-01 13:59 Richard Biener
2022-08-01 13:59 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).