aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2022-08-01 14:59:08 +0200
committerRichard Biener <rguenther@suse.de>2022-08-02 08:35:01 +0200
commitb9da686470d1c23929eefb401280ad8ba17e2a58 (patch)
tree01fd26ba0e652ecc48075edb0548c4e3b0361678 /gcc
parent325103829ef5996b66fff7ed77cc069c4394395b (diff)
downloadgcc-b9da686470d1c23929eefb401280ad8ba17e2a58.zip
gcc-b9da686470d1c23929eefb401280ad8ba17e2a58.tar.gz
gcc-b9da686470d1c23929eefb401280ad8ba17e2a58.tar.bz2
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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/tree-ssa-threadbackward.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/tree-ssa-threadbackward.cc b/gcc/tree-ssa-threadbackward.cc
index 90f5331..0519f2a 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))