Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard.
2015-12-17 Richard Biener <rguent...@suse.de> PR tree-optimization/68951 * tree-vect-data-refs.c (vect_peeling_hash_get_lowest_cost): Ignore strided non-group accesses. * gcc.dg/torture/pr68951.c: New testcase. Index: gcc/tree-vect-data-refs.c =================================================================== --- gcc/tree-vect-data-refs.c (revision 231745) +++ gcc/tree-vect-data-refs.c (working copy) @@ -1215,6 +1215,12 @@ vect_peeling_hash_get_lowest_cost (_vect && GROUP_FIRST_ELEMENT (stmt_info) != stmt) continue; + /* Strided accesses perform only component accesses, alignment is + irrelevant for them. */ + if (STMT_VINFO_STRIDED_P (stmt_info) + && !STMT_VINFO_GROUPED_ACCESS (stmt_info)) + continue; + save_misalignment = DR_MISALIGNMENT (dr); vect_update_misalignment_for_peel (dr, elem->dr, elem->npeel); vect_get_data_access_cost (dr, &inside_cost, &outside_cost, Index: gcc/testsuite/gcc.dg/torture/pr68951.c =================================================================== --- gcc/testsuite/gcc.dg/torture/pr68951.c (revision 0) +++ gcc/testsuite/gcc.dg/torture/pr68951.c (working copy) @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-w" } */ + +static int g_534[1][1]; +int fn1() +{ + int i; + for (i = 0; i < 4; i++) + g_534[i + 2][i] ^= 3; + for (;;) + ; +}