aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-im.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2015-09-15 14:10:10 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2015-09-15 14:10:10 +0000
commit4f912f91a095e78dc69ff875de4aeb41188c0655 (patch)
tree9289336911f82646a605073e7d3d0ba579f084ae /gcc/tree-ssa-loop-im.c
parent20adfc6c1cdc9ab49f9c930e52c1bb1ca4e2f433 (diff)
downloadgcc-4f912f91a095e78dc69ff875de4aeb41188c0655.zip
gcc-4f912f91a095e78dc69ff875de4aeb41188c0655.tar.gz
gcc-4f912f91a095e78dc69ff875de4aeb41188c0655.tar.bz2
re PR tree-optimization/67470 (ICE at -O3 on x86_64-linux-gnu in compute_live_loop_exits, at tree-ssa-loop-manip.c:235)
2015-09-15 Richard Biener <rguenther@suse.de> PR tree-optimization/67470 * tree-ssa-loop-im.c (execute_sm_if_changed): Preserve PHI structure for PHI hoisting by inserting a forwarder block if appropriate. * gcc.dg/torture/pr67470.c: New testcase. From-SVN: r227797
Diffstat (limited to 'gcc/tree-ssa-loop-im.c')
-rw-r--r--gcc/tree-ssa-loop-im.c17
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);