From 25853b33482749fb6a07336ea3790a45cc1752f7 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 26 Jun 2017 07:19:37 +0000 Subject: re PR tree-optimization/80928 (SLP vectorization does not handle induction in outer loop vectorization) 2017-06-26 Richard Biener PR tree-optimization/80928 * cfghooks.c (duplicate_block): Do not copy BB_DUPLICATED flag. (copy_bbs): Set BB_DUPLICATED flag early. (execute_on_growing_pred): Do not execute for BB_DUPLICATED marked blocks. (execute_on_shrinking_pred): Likewise. * tree-ssa.c (ssa_redirect_edge): Do not look for PHI args in BB_DUPLICATED blocks. * tree-ssa-phionlycoprop.c (eliminate_degenerate_phis_1): Properly iterate over all PHIs considering removal of *gsi. From-SVN: r249638 --- gcc/tree-ssa.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 45b9951bf25..fa8f81e9a1a 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -142,21 +142,24 @@ ssa_redirect_edge (edge e, basic_block dest) redirect_edge_var_map_clear (e); - /* Remove the appropriate PHI arguments in E's destination block. */ - for (gsi = gsi_start_phis (e->dest); !gsi_end_p (gsi); gsi_next (&gsi)) - { - tree def; - source_location locus ; - - phi = gsi.phi (); - def = gimple_phi_arg_def (phi, e->dest_idx); - locus = gimple_phi_arg_location (phi, e->dest_idx); - - if (def == NULL_TREE) - continue; - - redirect_edge_var_map_add (e, gimple_phi_result (phi), def, locus); - } + /* Remove the appropriate PHI arguments in E's destination block. + If we are redirecting a copied edge the destination has not + got PHI argument space reserved nor an interesting argument. */ + if (! (e->dest->flags & BB_DUPLICATED)) + for (gsi = gsi_start_phis (e->dest); !gsi_end_p (gsi); gsi_next (&gsi)) + { + tree def; + source_location locus ; + + phi = gsi.phi (); + def = gimple_phi_arg_def (phi, e->dest_idx); + locus = gimple_phi_arg_location (phi, e->dest_idx); + + if (def == NULL_TREE) + continue; + + redirect_edge_var_map_add (e, gimple_phi_result (phi), def, locus); + } e = redirect_edge_succ_nodup (e, dest); -- cgit v1.2.3