aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-predicate-analysis.cc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2022-09-08 12:22:26 +0200
committerRichard Biener <rguenther@suse.de>2022-09-08 13:11:32 +0200
commitc8d3b44dfa2851659f966627835497667c5fed6c (patch)
tree53ac590dec21943b05a62252a189fe876d9e5716 /gcc/gimple-predicate-analysis.cc
parent794a01d7dcf306578bc5d0d147895c58a91506de (diff)
downloadgcc-c8d3b44dfa2851659f966627835497667c5fed6c.zip
gcc-c8d3b44dfa2851659f966627835497667c5fed6c.tar.gz
gcc-c8d3b44dfa2851659f966627835497667c5fed6c.tar.bz2
tree-optimization/106881 - constrain uninit control edge add
The following avoids adding fallthru edges to the control chain from the post-dominator walk. PR tree-optimization/106881 * gimple-predicate-analysis.cc (compute_control_dep_chain_pdom): Add only non-fallthru edges and avoid the same set of edges as the caller does. * gcc.dg/uninit-pr106881.c: New testcase.
Diffstat (limited to 'gcc/gimple-predicate-analysis.cc')
-rw-r--r--gcc/gimple-predicate-analysis.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/gimple-predicate-analysis.cc b/gcc/gimple-predicate-analysis.cc
index f81af25..910ab97 100644
--- a/gcc/gimple-predicate-analysis.cc
+++ b/gcc/gimple-predicate-analysis.cc
@@ -1060,9 +1060,12 @@ compute_control_dep_chain_pdom (basic_block cd_bb, const_basic_block dep_bb,
gcc.dg/unninit-pred-12.c and PR106754. */
if (single_pred_p (cd_bb))
{
- edge e2 = find_edge (prev_cd_bb, cd_bb);
- gcc_assert (e2);
- cur_cd_chain.safe_push (e2);
+ edge e2 = single_pred_edge (cd_bb);
+ gcc_assert (e2->src == prev_cd_bb);
+ /* But avoid adding fallthru or abnormal edges. */
+ if (!(e2->flags & (EDGE_FAKE | EDGE_ABNORMAL | EDGE_DFS_BACK))
+ && !single_succ_p (prev_cd_bb))
+ cur_cd_chain.safe_push (e2);
}
}
return found_cd_chain;