re PR tree-optimization/58228 (wrong code (with vectorization?) at -O3 on x86_64...
authorRichard Biener <rguenther@suse.de>
Fri, 30 Aug 2013 07:49:54 +0000 (07:49 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 30 Aug 2013 07:49:54 +0000 (07:49 +0000)
2013-08-30  Richard Biener  <rguenther@suse.de>

PR tree-optimization/58228
* tree-vect-data-refs.c (vect_analyze_data_ref_access): Do not
allow invariant loads in nested loop vectorization.

* gcc.dg/torture/pr58228.c: New testcase.

From-SVN: r202097

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

index 7a8782b0f13b292e2e392ac1e0a284ff87efafc0..5720a2a2680322f4c9021dcdf060e941edb755fd 100644 (file)
@@ -1,3 +1,9 @@
+2013-08-30  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/58228
+       * tree-vect-data-refs.c (vect_analyze_data_ref_access): Do not
+       allow invariant loads in nested loop vectorization.
+
 2013-08-30  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/58223
index e6fa611cf502209980173e269e303c94c3f36bba..68861a8e1ab0ca276fa41575c41d5ad53d6a8023 100644 (file)
@@ -1,3 +1,8 @@
+2013-08-30  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/58228
+       * gcc.dg/torture/pr58228.c: New testcase.
+
 2013-08-30  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/58223
diff --git a/gcc/testsuite/gcc.dg/torture/pr58228.c b/gcc/testsuite/gcc.dg/torture/pr58228.c
new file mode 100644 (file)
index 0000000..d12303a
--- /dev/null
@@ -0,0 +1,15 @@
+/* { dg-do run } */
+
+extern void abort (void);
+int a[8][8] = {{1}};
+int b, c, d, e;
+
+int main ()
+{
+  for (c = 0; c < 8; c++)
+    for (b = 0; b < 2; b++)
+      a[b + 4][c] = a[c][0];
+  if (a[4][4] != 1)
+    abort ();
+  return 0;
+}
index 4c12f49391617bb4d1be2751400c16674fe3b860..7ebdcfe53cf27d072484014f3f59308d4b367637 100644 (file)
@@ -2271,10 +2271,17 @@ vect_analyze_data_ref_access (struct data_reference *dr)
       return false;
     }
 
-  /* Allow invariant loads in loops.  */
+  /* Allow invariant loads in not nested loops.  */
   if (loop_vinfo && integer_zerop (step))
     {
       GROUP_FIRST_ELEMENT (vinfo_for_stmt (stmt)) = NULL;
+      if (nested_in_vect_loop_p (loop, stmt))
+       {
+         if (dump_enabled_p ())
+           dump_printf_loc (MSG_NOTE, vect_location,
+                            "zero step in inner loop of nest");
+         return false;
+       }
       return DR_IS_READ (dr);
     }