diff options
Diffstat (limited to 'gcc/tree-ssa-loop-im.c')
-rw-r--r-- | gcc/tree-ssa-loop-im.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c index f1d4a8c..f67b57d 100644 --- a/gcc/tree-ssa-loop-im.c +++ b/gcc/tree-ssa-loop-im.c @@ -1839,6 +1839,23 @@ execute_sm_if_changed (edge ex, tree mem, tree tmp_var, tree flag) if (loop_has_only_one_exit) ex = split_block_after_labels (ex->dest); + else + { + for (gphi_iterator gpi = gsi_start_phis (ex->dest); + !gsi_end_p (gpi); gsi_next (&gpi)) + { + gphi *phi = gpi.phi (); + if (virtual_operand_p (gimple_phi_result (phi))) + continue; + + /* When the destination has a non-virtual PHI node with multiple + predecessors make sure we preserve the PHI structure by + forcing a forwarder block so that hoisting of that PHI will + still work. */ + split_edge (ex); + break; + } + } old_dest = ex->dest; new_bb = split_edge (ex); |