On Sun, Oct 30, 2011 at 5:38 AM, David Miller <da...@davemloft.net> wrote: > > gcc.dg/pr48616.c segfaults on sparc as of a day or two ago > > vectorizable_shift() crashes because op1_vectype is NULL and > we hit this code path: > > /* Vector shifted by vector. */ > if (!scalar_shift_arg) > { > optab = optab_for_tree_code (code, vectype, optab_vector); > if (vect_print_dump_info (REPORT_DETAILS)) > fprintf (vect_dump, "vector/vector shift/rotate found."); > => if (TYPE_MODE (op1_vectype) != TYPE_MODE (vectype)) > > dt[1] is vect_external_def and slp_node is non-NULL. > > Indeed, when the 'dt' arg to vect_is_simple_use_1() is > vect_external_def *vectype will be set to NULL. > > And scalar_shift_arg gets set to false because of this loop > check: > > if (slp_node) > { > VEC (gimple, heap) *stmts = SLP_TREE_SCALAR_STMTS (slp_node); > gimple slpstmt; > > FOR_EACH_VEC_ELT (gimple, stmts, k, slpstmt) > if (!operand_equal_p (gimple_assign_rhs2 (slpstmt), op1, 0)) > scalar_shift_arg = false; > } > > Indeed, this crashing test was added by this change:
Yeah, I thought testing the scalar modes would have been more natural. > 2011-10-28 Jakub Jelinek <ja...@redhat.com> > > * tree-vect-stmts.c (vectorizable_shift): Give up if op1 has different > vector mode from vectype's mode. >