re PR tree-optimization/68502 ([i686] spec2000/179.art runfails after r222914)
authorRichard Biener <rguenther@suse.de>
Wed, 25 Nov 2015 08:46:34 +0000 (08:46 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 25 Nov 2015 08:46:34 +0000 (08:46 +0000)
2015-11-25  Richard Biener  <rguenther@suse.de>

PR tree-optimization/68502
* tree-vect-data-refs.c (vect_analyze_group_access_1): Restore
check that the step is a multiple of the type size.

* gcc.dg/vect/pr68502-1.c: New testcase.
* gcc.dg/vect/pr68502-2.c: Likewise.

From-SVN: r230854

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

index fd78249b010274159ed02693166c04b728b5c134..362f21f1a9cacd2db8ac61379aad428f172fd8ad 100644 (file)
@@ -1,3 +1,9 @@
+2015-11-25  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/68502
+       * tree-vect-data-refs.c (vect_analyze_group_access_1): Restore
+       check that the step is a multiple of the type size.
+
 2015-11-24  Michael Collison  <michael.collison@linaro.org>
 
        * config/aarch64/aarch64-simd.md (widen_ssum, widen_usum)
index cff124d30a05bee6c2a680e90b5acbfa0d3756dd..ec80893ee43963ee8f7fca2eae5d451aa06235a6 100644 (file)
@@ -1,3 +1,9 @@
+2015-11-25  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/68502
+       * gcc.dg/vect/pr68502-1.c: New testcase.
+       * gcc.dg/vect/pr68502-2.c: Likewise.
+
 2015-11-24  Michael Collison  <michael.collison@linaro.org>
 
        * gcc.target/aarch64/saddw-1.c: New test.
diff --git a/gcc/testsuite/gcc.dg/vect/pr68502-1.c b/gcc/testsuite/gcc.dg/vect/pr68502-1.c
new file mode 100644 (file)
index 0000000..4f7d0bf
--- /dev/null
@@ -0,0 +1,48 @@
+#include <stdlib.h>
+#include "tree-vect.h"
+
+typedef struct {
+    double *I;
+    double W;
+    double X;
+    double V;
+    double U;
+    double P;
+    double Q;
+    double R;
+} f1_neuron;
+
+f1_neuron *f1_layer;
+
+int numf1s = 1000;
+
+void __attribute__((noinline,noclone))
+reset_nodes() 
+{
+  int i;
+
+  for (i=0;i<numf1s;i++)
+    {
+      f1_layer[i].W = 0.0;
+      f1_layer[i].X = 0.0;
+      f1_layer[i].V = 0.0;
+      f1_layer[i].U = 0.0;
+      f1_layer[i].P = 0.0;
+      f1_layer[i].Q = 0.0;
+      f1_layer[i].R = 0.0;
+    }
+}
+
+int main ()
+{
+  int i;
+  check_vect ();
+  f1_layer = (f1_neuron *)malloc (numf1s * sizeof (f1_neuron));
+  for (i = 0; i < numf1s; i++)
+    f1_layer[i].I = (double *)-1;
+  reset_nodes ();
+  for (i = 0; i < numf1s; i++)
+    if (f1_layer[i].I != (double *)-1)
+      abort ();
+  return 0; 
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr68502-2.c b/gcc/testsuite/gcc.dg/vect/pr68502-2.c
new file mode 100644 (file)
index 0000000..a3eddaf
--- /dev/null
@@ -0,0 +1,48 @@
+#include <stdlib.h>
+#include "tree-vect.h"
+
+typedef struct {
+    short I;
+    int W;
+    int X;
+    int V;
+    int U;
+    int P;
+    int Q;
+    int R;
+} __attribute__((packed)) f1_neuron;
+
+f1_neuron *f1_layer;
+
+int numf1s = 1000;
+
+void __attribute__((noinline,noclone))
+reset_nodes() 
+{
+  int i;
+
+  for (i=0;i<numf1s;i++)
+    {
+      f1_layer[i].W = 0;
+      f1_layer[i].X = 0;
+      f1_layer[i].V = 0;
+      f1_layer[i].U = 0;
+      f1_layer[i].P = 0;
+      f1_layer[i].Q = 0;
+      f1_layer[i].R = 0;
+    }
+}
+
+int main ()
+{
+  int i;
+  check_vect ();
+  f1_layer = (f1_neuron *)malloc (numf1s * sizeof (f1_neuron));
+  for (i = 0; i < numf1s; i++)
+    f1_layer[i].I = -1;
+  reset_nodes ();
+  for (i = 0; i < numf1s; i++)
+    if (f1_layer[i].I != -1)
+      abort ();
+  return 0; 
+}
index f4436b544301c5d87bd8c97e89b2f97646f5a7b1..d788b59dc7b5659b9f991ded054828eb2d437927 100644 (file)
@@ -2176,6 +2176,27 @@ vect_analyze_group_access_1 (struct data_reference *dr)
   if (tree_fits_shwi_p (step))
     {
       dr_step = tree_to_shwi (step);
+      /* Check that STEP is a multiple of type size.  Otherwise there is
+         a non-element-sized gap at the end of the group which we
+        cannot represent in GROUP_GAP or GROUP_SIZE.
+        ???  As we can handle non-constant step fine here we should
+        simply remove uses of GROUP_GAP between the last and first
+        element and instead rely on DR_STEP.  GROUP_SIZE then would
+        simply not include that gap.  */
+      if ((dr_step % type_size) != 0)
+       {
+         if (dump_enabled_p ())
+           {
+             dump_printf_loc (MSG_NOTE, vect_location,
+                              "Step ");
+             dump_generic_expr (MSG_NOTE, TDF_SLIM, step);
+             dump_printf (MSG_NOTE,
+                          " is not a multiple of the element size for ");
+             dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (dr));
+             dump_printf (MSG_NOTE, "\n");
+           }
+         return false;
+       }
       groupsize = absu_hwi (dr_step) / type_size;
     }
   else