The following fixes SLP pure/hybrid detection with patterns. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk sofar.
Richard. 2014-08-11 Richard Biener <rguent...@suse.de> PR tree-optimization/62075 * tree-vect-slp.c (vect_detect_hybrid_slp_stmts): Properly handle uses in patterns. * gcc.dg/vect/pr62075.c: New testcase. Index: gcc/testsuite/gcc.dg/vect/pr62075.c =================================================================== --- gcc/testsuite/gcc.dg/vect/pr62075.c (revision 0) +++ gcc/testsuite/gcc.dg/vect/pr62075.c (working copy) @@ -0,0 +1,22 @@ +/* { dg-do compile } */ + +int a[16][2]; +struct A +{ + int b[16][2]; + int c[16][1]; +}; + +void +foo (struct A *x) +{ + int i; + for (i = 0; i < 16; ++i) + { + x->b[i][0] = a[i][0]; + x->c[i][0] = 0 != a[i][0]; + x->b[i][1] = a[i][1]; + } +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ Index: gcc/tree-vect-slp.c =================================================================== *** gcc/tree-vect-slp.c (revision 213811) --- gcc/tree-vect-slp.c (working copy) *************** vect_detect_hybrid_slp_stmts (slp_tree n *** 1793,1799 **** && (stmt_vinfo = vinfo_for_stmt (use_stmt)) && !STMT_SLP_TYPE (stmt_vinfo) && (STMT_VINFO_RELEVANT (stmt_vinfo) ! || VECTORIZABLE_CYCLE_DEF (STMT_VINFO_DEF_TYPE (stmt_vinfo))) && !(gimple_code (use_stmt) == GIMPLE_PHI && STMT_VINFO_DEF_TYPE (stmt_vinfo) == vect_reduction_def)) --- 1793,1802 ---- && (stmt_vinfo = vinfo_for_stmt (use_stmt)) && !STMT_SLP_TYPE (stmt_vinfo) && (STMT_VINFO_RELEVANT (stmt_vinfo) ! || VECTORIZABLE_CYCLE_DEF (STMT_VINFO_DEF_TYPE (stmt_vinfo)) ! || (STMT_VINFO_IN_PATTERN_P (stmt_vinfo) ! && STMT_VINFO_RELATED_STMT (stmt_vinfo) ! && !STMT_SLP_TYPE (vinfo_for_stmt (STMT_VINFO_RELATED_STMT (stmt_vinfo))))) && !(gimple_code (use_stmt) == GIMPLE_PHI && STMT_VINFO_DEF_TYPE (stmt_vinfo) == vect_reduction_def))