Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard.
2015-10-27 Richard Biener <rguent...@suse.de> PR tree-optimization/68104 * tree-vect-data-refs.c (vect_compute_data_ref_alignment): Move strided access check ... (vect_compute_data_refs_alignment): ... here. * gcc.dg/torture/pr68104.c: New testcase. Index: gcc/tree-vect-data-refs.c =================================================================== *** gcc/tree-vect-data-refs.c (revision 229404) --- gcc/tree-vect-data-refs.c (working copy) *************** vect_compute_data_ref_alignment (struct *** 629,640 **** /* Initialize misalignment to unknown. */ SET_DR_MISALIGNMENT (dr, -1); - /* Strided accesses perform only component accesses, misalignment information - is irrelevant for them. */ - if (STMT_VINFO_STRIDED_P (stmt_info) - && !STMT_VINFO_GROUPED_ACCESS (stmt_info)) - return true; - if (tree_fits_shwi_p (DR_STEP (dr))) misalign = DR_INIT (dr); aligned_to = DR_ALIGNED_TO (dr); --- 651,656 ---- *************** vect_compute_data_refs_alignment (vec_in *** 794,811 **** unsigned int i; FOR_EACH_VEC_ELT (datarefs, i, dr) ! if (STMT_VINFO_VECTORIZABLE (vinfo_for_stmt (DR_STMT (dr))) ! && !vect_compute_data_ref_alignment (dr)) ! { ! if (is_a <bb_vec_info> (vinfo)) ! { ! /* Mark unsupported statement as unvectorizable. */ ! STMT_VINFO_VECTORIZABLE (vinfo_for_stmt (DR_STMT (dr))) = false; ! continue; ! } ! else ! return false; ! } return true; } --- 810,836 ---- unsigned int i; FOR_EACH_VEC_ELT (datarefs, i, dr) ! { ! stmt_vec_info stmt_info = vinfo_for_stmt (DR_STMT (dr)); ! if (STMT_VINFO_VECTORIZABLE (stmt_info) ! && !vect_compute_data_ref_alignment (dr)) ! { ! /* Strided accesses perform only component accesses, misalignment ! information is irrelevant for them. */ ! if (STMT_VINFO_STRIDED_P (stmt_info) ! && !STMT_VINFO_GROUPED_ACCESS (stmt_info)) ! continue; ! ! if (is_a <bb_vec_info> (vinfo)) ! { ! /* Mark unsupported statement as unvectorizable. */ ! STMT_VINFO_VECTORIZABLE (vinfo_for_stmt (DR_STMT (dr))) = false; ! continue; ! } ! else ! return false; ! } ! } return true; } Index: gcc/testsuite/gcc.dg/torture/pr68104.c =================================================================== *** gcc/testsuite/gcc.dg/torture/pr68104.c (revision 0) --- gcc/testsuite/gcc.dg/torture/pr68104.c (working copy) *************** *** 0 **** --- 1,22 ---- + /* { dg-do compile } */ + + typedef struct + { + char vl; + char weight; + } ib_vl_arb_element_t; + typedef struct { ib_vl_arb_element_t vl_entry[32]; } ib_vl_arb_table_t; + typedef enum { IB_SUCCESS } ib_api_status_t; + int a, b, d; + char c; + void fn1(); + ib_api_status_t fn2() + { + int e = b; + ib_vl_arb_table_t f; + if (e) + for (a = 0; a < d; a++) + f.vl_entry[a].vl &= c; + fn1(f); + return IB_SUCCESS; + }