I am testing the following patch to fix a latent bug in the vectorizer dealing with redundant DRs.
Bootstrap and regtest pending on x86_64-unknown-linux-gnu. Richard. 2015-01-12 Richard Biener <rguent...@suse.de> PR tree-optimization/64404 * tree-vect-stmts.c (vectorizable_load): Use the proper vectorized stmts for CSEing loads with the same DR. * gcc.dg/vect/pr64404.c: New testcase. Index: gcc/tree-vect-stmts.c =================================================================== --- gcc/tree-vect-stmts.c (revision 219446) +++ gcc/tree-vect-stmts.c (working copy) @@ -6155,7 +6155,7 @@ vectorizable_load (gimple stmt, gimple_s is even wrong code. See PR56270. */ && !slp) { - *vec_stmt = STMT_VINFO_VEC_STMT (stmt_info); + *vec_stmt = STMT_VINFO_VEC_STMT (vinfo_for_stmt (first_stmt)); return true; } first_dr = STMT_VINFO_DATA_REF (vinfo_for_stmt (first_stmt)); Index: gcc/testsuite/gcc.dg/vect/pr64404.c =================================================================== --- gcc/testsuite/gcc.dg/vect/pr64404.c (revision 0) +++ gcc/testsuite/gcc.dg/vect/pr64404.c (working copy) @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-additional-options "--param=sccvn-max-alias-queries-per-access=1" } */ + +typedef struct +{ + float l, h; +} tFPinterval; + +tFPinterval X[1024]; +tFPinterval Y[1024]; +tFPinterval Z[1024]; + +void +Compute (void) +{ + int d; + for (d = 0; d < 1024; d++) + { + Y[d].l = X[d].l + X[d].h; + Y[d].h = Y[d].l; + Z[d].l = X[d].l; + Z[d].h = X[d].h; + } +} + +/* { dg-final { cleanup-tree-dump "vect" } } */