https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106228
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |ASSIGNED --- Comment #13 from Richard Biener <rguenth at gcc dot gnu.org> --- OK, it's vect_setup_realignment called from tree offset = NULL_TREE; if ((alignment_support_scheme == dr_explicit_realign_optimized || alignment_support_scheme == dr_explicit_realign) && !compute_in_loop) { /* If we have different first_stmt_info, we can't set up realignment here, since we can't guarantee first_stmt_info DR has been initialized yet, use first_stmt_info_for_drptr DR by bumping the distance from first_stmt_info DR instead as below. */ if (!diff_first_stmt_info) msq = vect_setup_realignment (vinfo, first_stmt_info, gsi, &realignment_token, alignment_support_scheme, NULL_TREE, &at_loop); The following fixes that ICE. diff --git a/gcc/tree-vect-data-refs.cc b/gcc/tree-vect-data-refs.cc index d20a10a1524..53e52cb58cb 100644 --- a/gcc/tree-vect-data-refs.cc +++ b/gcc/tree-vect-data-refs.cc @@ -5780,6 +5780,13 @@ vect_setup_realignment (vec_info *vinfo, stmt_vec_info stmt_info, if (loop_for_initial_load) pe = loop_preheader_edge (loop_for_initial_load); + tree vuse; + gphi *vphi = get_virtual_phi (loop_for_initial_load->header); + if (vphi) + vuse = PHI_ARG_DEF_FROM_EDGE (vphi, pe); + else + vuse = gimple_vuse (gsi_stmt (*gsi)); + /* 3. For the case of the optimized realignment, create the first vector load at the loop preheader. */ @@ -5813,6 +5820,7 @@ vect_setup_realignment (vec_info *vinfo, stmt_vec_info stmt_info, new_stmt = gimple_build_assign (vec_dest, data_ref); new_temp = make_ssa_name (vec_dest, new_stmt); gimple_assign_set_lhs (new_stmt, new_temp); + gimple_set_vuse (new_stmt, vuse); if (pe) { new_bb = gsi_insert_on_edge_immediate (pe, new_stmt); The testsuite FAILs seem to use -mdejagnu-cpu=power7 so likely are the same.