aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-phiopt.cc
diff options
context:
space:
mode:
authorAndrew Pinski <apinski@marvell.com>2023-01-28 18:27:08 +0000
committerAndrew Pinski <apinski@marvell.com>2023-01-30 12:45:35 +0000
commit876b3e0514bc8cb2256c44db56255403bedfa52d (patch)
tree3b00ac71475e3b05c1cf524b90bf203c641e3c08 /gcc/tree-ssa-phiopt.cc
parent7ac3e69e311351b70407d7f87a0169c4d463e57b (diff)
downloadgcc-876b3e0514bc8cb2256c44db56255403bedfa52d.zip
gcc-876b3e0514bc8cb2256c44db56255403bedfa52d.tar.gz
gcc-876b3e0514bc8cb2256c44db56255403bedfa52d.tar.bz2
Fix PR 108582: ICE due to PHI-OPT removing a still in use ssa_name.
This patch adds a check in match_simplify_replacement to make sure the middlebb does not have any phi-nodes as we don't currently move those. This was just a thinko from before. Ok? Bootstrapped and tested on x86_64-linux-gnu with no regressions? PR tree-optimization/108582 gcc/ChangeLog: * tree-ssa-phiopt.cc (match_simplify_replacement): Add check for middlebb to have no phi nodes. gcc/testsuite/ChangeLog: * gcc.dg/pr108582-1.c: New test.
Diffstat (limited to 'gcc/tree-ssa-phiopt.cc')
-rw-r--r--gcc/tree-ssa-phiopt.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc
index c3a889d..a7ab6ce 100644
--- a/gcc/tree-ssa-phiopt.cc
+++ b/gcc/tree-ssa-phiopt.cc
@@ -1002,6 +1002,11 @@ match_simplify_replacement (basic_block cond_bb, basic_block middle_bb,
if (!single_pred_p (middle_bb))
return false;
+ /* The middle bb cannot have phi nodes as we don't
+ move those assignments yet. */
+ if (!gimple_seq_empty_p (phi_nodes (middle_bb)))
+ return false;
+
stmt_to_move = last_and_only_stmt (middle_bb);
if (!stmt_to_move)
return false;