On Wed, May 9, 2012 at 2:38 PM, Michael Matz <m...@suse.de> wrote: > Hi, > > the current code for strided loads can't deal with the situation when a > prologue loop (peeling for alignment) is created after analyzing the data > refs. There are multiple issues (non-constant steps in DRs mainly), so > this is a simple stop gap. > > Regtesting on x86_64-linux (all langs) in progress. Okay for trunk?
Ok. Thanks, Richard. > > Ciao, > Michael. > -------------------- > PR tree-optimization/53185 > * tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Disable > peeling when we see strided loads. > > testsuite/ > * gcc.dg/vect/pr53185.c: New test. > > Index: tree-vect-data-refs.c > =================================================================== > --- tree-vect-data-refs.c (revision 187287) > +++ tree-vect-data-refs.c (working copy) > @@ -1507,6 +1507,17 @@ vect_enhance_data_refs_alignment (loop_v > && GROUP_FIRST_ELEMENT (stmt_info) != stmt) > continue; > > + /* FORNOW: Any strided load prevents peeling. The induction > + variable analysis will fail when the prologue loop is generated, > + and so we can't generate the new base for the pointer. */ > + if (STMT_VINFO_STRIDE_LOAD_P (stmt_info)) > + { > + if (vect_print_dump_info (REPORT_DETAILS)) > + fprintf (vect_dump, "strided load prevents peeling"); > + do_peeling = false; > + break; > + } > + > /* For invariant accesses there is nothing to enhance. */ > if (integer_zerop (DR_STEP (dr))) > continue; > Index: testsuite/gcc.dg/vect/pr53185.c > =================================================================== > --- testsuite/gcc.dg/vect/pr53185.c (revision 0) > +++ testsuite/gcc.dg/vect/pr53185.c (revision 0) > @@ -0,0 +1,16 @@ > +/* { dg-do compile } */ > +/* { dg-options "-O3 -ftree-vectorize" } */ > +unsigned short a, e; > +int *b, *d; > +int c; > +extern int fn2(); > +void fn1 () { > + void *f; > + for (;;) { > + fn2 (); > + b = f; > + e = 0; > + for (; e < a; ++e) > + b[e] = d[e * c]; > + } > +}