http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56157
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-01-31 11:09:40 UTC --- The problematic stmt is placed by: #0 vect_init_vector_1 (stmt=0x7ffff1abb6e0, new_stmt=0x7ffff1ad6a00, gsi=0x0) at ../../gcc/tree-vect-stmts.c:1240 #1 0x0000000000c36087 in vect_init_vector (stmt=0x7ffff1abb6e0, val=0x7ffff1aa3ea0, type=0x7ffff1ace2a0, gsi=0x0) at ../../gcc/tree-vect-stmts.c:1310 #2 0x0000000000c649f9 in vect_get_constant_vectors (op=0x7ffff1ac10d8, slp_node=0x18eb4d0, vec_oprnds=0x18eb470, op_num=0, number_of_vectors=4, reduc_index=-1) at ../../gcc/tree-vect-slp.c:2539 #3 0x0000000000c64f1c in vect_get_slp_defs (ops=..., slp_node=0x18eb4d0, vec_oprnds=0x7fffffffd750, reduc_index=-1) at ../../gcc/tree-vect-slp.c:2696 #4 0x0000000000c3686b in vect_get_vec_defs (op0=0x7ffff1ac10d8, op1=0x7ffff1ac3c20, stmt=0x7ffff1abb6e0, vec_oprnds0=0x7fffffffd7e0, vec_oprnds1=0x7fffffffd7d0, slp_node=0x18eb4d0, reduc_index=-1) at ../../gcc/tree-vect-stmts.c:1593 #5 0x0000000000c3cc73 in vectorizable_operation (stmt=0x7ffff1abb6e0, gsi=0x7fffffffda20, vec_stmt=0x7fffffffd980, slp_node=0x18eb4d0) at ../../gcc/tree-vect-stmts.c:3728 #6 0x0000000000c43330 in vect_transform_stmt (stmt=0x7ffff1abb6e0, gsi=0x7fffffffda20, grouped_store=0x7fffffffda3a, slp_node=0x18eb4d0, slp_node_instance=0x18eb8d0) at ../../gcc/tree-vect-stmts.c:5793 #7 0x0000000000c65de3 in vect_schedule_slp_instance (node=0x18eb4d0, instance=0x18eb8d0, vectorization_factor=4) at ../../gcc/tree-vect-slp.c:3095 #8 0x0000000000c659e2 in vect_schedule_slp_instance (node=0x18eb360, instance=0x18eb8d0, vectorization_factor=4) at ../../gcc/tree-vect-slp.c:3020 #9 0x0000000000c659e2 in vect_schedule_slp_instance (node=0x18eb290, instance=0x18eb8d0, vectorization_factor=4) at ../../gcc/tree-vect-slp.c:3020 #10 0x0000000000c659e2 in vect_schedule_slp_instance (node=0x18eafd0, instance=0x18eb8d0, vectorization_factor=4) at ../../gcc/tree-vect-slp.c:3020 #11 0x0000000000c66054 in vect_schedule_slp (loop_vinfo=0x18e1710, bb_vinfo=0x0) at ../../gcc/tree-vect-slp.c:3165 #12 0x0000000000c5570c in vect_transform_loop (loop_vinfo=0x18e1710) at ../../gcc/tree-vect-loop.c:5693 One thing that might be problematic is that stmt in this case is a pattern stmt, not original one, but my reading of vect_init_vector_1 shows that probably it shouldn't make a difference, it only cares about gimple_bb of the stmt (which should be the same between pattern and original stmt) and some details from stmt_vinfo (STMT_VINFO_LOOP_VINFO and STMT_VINFO_BB_VINFO should be the same too, in this case the first one is non-NULL (and not a nested loop), the latter is NULL). So, IMHO, either the bug is in vect_get_constant_vectors where it doesn't supply non-NULL last argument to vect_init_vector call, or in vect_get_slp_defs. Given "For constant and loop invariant defs of SLP_NODE this function returns"... comment probably not vect_get_constant_vectors fault, the arguments in this case aren't constant nor loop invariant. But given: "Otherwise, the def-stmts must be already vectorized and the vectorized stmts must be stored in the corresponding child of SLP_NODE, and we call vect_get_slp_vect_defs () to retrieve them." the bug might be somewhere earlier too. Richard, can you please have a look? Thanks.