From: Richard Biener Date: Fri, 26 Oct 2018 07:12:02 +0000 (+0000) Subject: re PR tree-optimization/87746 (ICE in vect_update_misalignment_for_peel, at tree... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7ea4b8ed7b960e25d81c14842f7458e9f29c2042;p=gcc.git re PR tree-optimization/87746 (ICE in vect_update_misalignment_for_peel, at tree-vect-data-refs.c:1035) 2018-10-26 Richard Biener PR tree-optimization/87746 * tree-vect-data-refs.c (vect_update_misalignment_for_peel): Simplify and fix WRT strided store groups with size not equal to step in element count. (vect_analyze_group_access_1): Dump the whole group. * gcc.dg/pr87746.c: New testcase. From-SVN: r265517 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 94e99b0c505..46524ee4d51 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2018-10-26 Richard Biener + + PR tree-optimization/87746 + * tree-vect-data-refs.c (vect_update_misalignment_for_peel): + Simplify and fix WRT strided store groups with size not + equal to step in element count. + (vect_analyze_group_access_1): Dump the whole group. + 2018-10-25 Carl Love * config/rs6000/rs6000-c.c (P9V_BUILTIN_VEC_VSCEDPGT, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index aa81538ea78..082e342f3f9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-10-26 Richard Biener + + PR tree-optimization/87746 + * gcc.dg/pr87746.c: New testcase. + 2018-10-26 Rainer Orth * gcc.dg/pr78973-2.c: Remove xfail on dg-warning. diff --git a/gcc/testsuite/gcc.dg/pr87746.c b/gcc/testsuite/gcc.dg/pr87746.c new file mode 100644 index 00000000000..139651674e4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr87746.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-Ofast" } */ +/* { dg-additional-options "-mavx2" { target x86_64-*-* i?86-*-* } } */ + +typedef struct rtx_def *rtx; +struct replacement { + rtx *where; + rtx *subreg_loc; + int mode; +}; +static struct replacement replacements[150]; +void move_replacements (rtx *x, rtx *y, int n_replacements) +{ + int i; + for (i = 0; i < n_replacements; i++) + if (replacements[i].subreg_loc == x) + replacements[i].subreg_loc = y; + else if (replacements[i].where == x) + { + replacements[i].where = y; + replacements[i].subreg_loc = 0; + } +} diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 92173442108..5f08cdf42cc 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -1010,20 +1010,10 @@ vect_update_misalignment_for_peel (dr_vec_info *dr_info, unsigned int i; vec same_aligned_drs; struct data_reference *current_dr; - int dr_size = vect_get_scalar_dr_size (dr_info); - int dr_peel_size = vect_get_scalar_dr_size (dr_peel_info); - stmt_vec_info stmt_info = dr_info->stmt; stmt_vec_info peel_stmt_info = dr_peel_info->stmt; - /* For interleaved data accesses the step in the loop must be multiplied by - the size of the interleaving group. */ - if (STMT_VINFO_GROUPED_ACCESS (stmt_info)) - dr_size *= DR_GROUP_SIZE (DR_GROUP_FIRST_ELEMENT (stmt_info)); - if (STMT_VINFO_GROUPED_ACCESS (peel_stmt_info)) - dr_peel_size *= DR_GROUP_SIZE (peel_stmt_info); - - /* It can be assumed that the data refs with the same alignment as dr_peel - are aligned in the vector loop. */ + /* It can be assumed that if dr_info has the same alignment as dr_peel, + it is aligned in the vector loop. */ same_aligned_drs = STMT_VINFO_SAME_ALIGN_REFS (peel_stmt_info); FOR_EACH_VEC_ELT (same_aligned_drs, i, current_dr) { @@ -1031,8 +1021,8 @@ vect_update_misalignment_for_peel (dr_vec_info *dr_info, continue; gcc_assert (!known_alignment_for_access_p (dr_info) || !known_alignment_for_access_p (dr_peel_info) - || (DR_MISALIGNMENT (dr_info) / dr_size - == DR_MISALIGNMENT (dr_peel_info) / dr_peel_size)); + || (DR_MISALIGNMENT (dr_info) + == DR_MISALIGNMENT (dr_peel_info))); SET_DR_MISALIGNMENT (dr_info, 0); return; } @@ -1040,10 +1030,8 @@ vect_update_misalignment_for_peel (dr_vec_info *dr_info, if (known_alignment_for_access_p (dr_info) && known_alignment_for_access_p (dr_peel_info)) { - bool negative = tree_int_cst_compare (DR_STEP (dr_info->dr), - size_zero_node) < 0; int misal = DR_MISALIGNMENT (dr_info); - misal += negative ? -npeel * dr_size : npeel * dr_size; + misal += npeel * TREE_INT_CST_LOW (DR_STEP (dr_info->dr)); misal &= DR_TARGET_ALIGNMENT (dr_info) - 1; SET_DR_MISALIGNMENT (dr_info, misal); return; @@ -2559,11 +2547,22 @@ vect_analyze_group_access_1 (dr_vec_info *dr_info) dump_printf (MSG_NOTE, "strided store "); else dump_printf (MSG_NOTE, "store "); - dump_printf (MSG_NOTE, "of size %u starting with %G", - (unsigned)groupsize, stmt_info->stmt); + dump_printf (MSG_NOTE, "of size %u\n", + (unsigned)groupsize); + dump_printf_loc (MSG_NOTE, vect_location, "\t%G", stmt_info->stmt); + next = DR_GROUP_NEXT_ELEMENT (stmt_info); + while (next) + { + if (DR_GROUP_GAP (next) != 1) + dump_printf_loc (MSG_NOTE, vect_location, + "\t\n", + DR_GROUP_GAP (next) - 1); + dump_printf_loc (MSG_NOTE, vect_location, "\t%G", next->stmt); + next = DR_GROUP_NEXT_ELEMENT (next); + } if (DR_GROUP_GAP (stmt_info) != 0) dump_printf_loc (MSG_NOTE, vect_location, - "There is a gap of %u elements after the group\n", + "\t\n", DR_GROUP_GAP (stmt_info)); }