2012-05-18 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 18 May 2012 12:09:49 +0000 (12:09 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 18 May 2012 12:09:49 +0000 (12:09 +0000)
PR tree-optimization/53390
* tree-vect-data-refs.c (vect_compute_data_ref_alignment): Ignore
strided loads.

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@187653 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 0d91248..70571cd 100644 (file)
@@ -1,3 +1,9 @@
+2012-05-18  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/53390
+       * tree-vect-data-refs.c (vect_compute_data_ref_alignment): Ignore
+       strided loads.
+
 2012-05-18  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
        * tree-ssa-reassoc.c (bip_map): Remove decl.
index 64a011c..fb6ede6 100644 (file)
@@ -1,3 +1,8 @@
+2012-05-18  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/53390
+       * gcc.dg/torture/pr53390.c: New testcase.
+
 2012-05-18  Meador Inge  <meadori@codesourcery.com>
 
        PR rtl-optimization/53352
diff --git a/gcc/testsuite/gcc.dg/torture/pr53390.c b/gcc/testsuite/gcc.dg/torture/pr53390.c
new file mode 100644 (file)
index 0000000..72a25c5
--- /dev/null
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+
+extern unsigned short var1;
+extern int var2;
+
+extern struct {
+  int f1;
+  unsigned short *f2;
+} *my_table;
+
+void foo(void)
+{
+  unsigned short *local_vec
+    = __builtin_malloc(var1 * var2 * sizeof(unsigned short));
+  unsigned short i;
+
+  my_table[0].f2 = __builtin_malloc(var1 * sizeof(unsigned short));
+
+  for (i = 0; i < var1; ++i)
+    my_table[0].f2[i] = local_vec[i * var2];
+}
index c8882ae..a5ed053 100644 (file)
@@ -824,6 +824,11 @@ vect_compute_data_ref_alignment (struct data_reference *dr)
   /* Initialize misalignment to unknown.  */
   SET_DR_MISALIGNMENT (dr, -1);
 
+  /* Strided loads perform only component accesses, misalignment information
+     is irrelevant for them.  */
+  if (STMT_VINFO_STRIDE_LOAD_P (stmt_info))
+    return true;
+
   misalign = DR_INIT (dr);
   aligned_to = DR_ALIGNED_TO (dr);
   base_addr = DR_BASE_ADDRESS (dr);