This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR53390


This fixes another fallout of proper strided load support.
vect_compute_data_ref_alignment can just bail out for them.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

Richard.

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.

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

Index: gcc/tree-vect-data-refs.c
===================================================================
*** gcc/tree-vect-data-refs.c	(revision 187650)
--- gcc/tree-vect-data-refs.c	(working copy)
*************** vect_compute_data_ref_alignment (struct
*** 824,829 ****
--- 824,834 ----
    /* 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);
Index: gcc/testsuite/gcc.dg/torture/pr53390.c
===================================================================
*** gcc/testsuite/gcc.dg/torture/pr53390.c	(revision 0)
--- gcc/testsuite/gcc.dg/torture/pr53390.c	(revision 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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]