re PR tree-optimization/87746 (ICE in vect_update_misalignment_for_peel, at tree...
authorRichard Biener <rguenther@suse.de>
Fri, 26 Oct 2018 07:12:02 +0000 (07:12 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 26 Oct 2018 07:12:02 +0000 (07:12 +0000)
2018-10-26  Richard Biener  <rguenther@suse.de>

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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr87746.c [new file with mode: 0644]
gcc/tree-vect-data-refs.c

index 94e99b0c505a63893c63b5f904592aea1eccea25..46524ee4d519b07684d78532cc5e649b11005df9 100644 (file)
@@ -1,3 +1,11 @@
+2018-10-26  Richard Biener  <rguenther@suse.de>
+
+       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  <cel@us.ibm.com>
 
        * config/rs6000/rs6000-c.c (P9V_BUILTIN_VEC_VSCEDPGT,
index aa81538ea781f0030fca5d58f791e083075078bd..082e342f3f918e4e21325ffcab83a0d0d11c8532 100644 (file)
@@ -1,3 +1,8 @@
+2018-10-26  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/87746
+       * gcc.dg/pr87746.c: New testcase.
+
 2018-10-26  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        * 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 (file)
index 0000000..1396516
--- /dev/null
@@ -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;
+      }
+}
index 9217344210818c41f8eb16ad5fc18e15d9b7fadc..5f08cdf42ccd39484af50c5539f8a2d2ecb5791b 100644 (file)
@@ -1010,20 +1010,10 @@ vect_update_misalignment_for_peel (dr_vec_info *dr_info,
   unsigned int i;
   vec<dr_p> 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<gap of %d elements>\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<gap of %d elements>\n",
                             DR_GROUP_GAP (stmt_info));
        }