On Tue, 16 Feb 2016, Jakub Jelinek wrote: > On Tue, Feb 16, 2016 at 09:58:37AM +0100, Richard Biener wrote: > > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? > > > > Hmm, most places calling type_conversion_p already check for the > > pattern case and only accept a very specific or fail. > > > > Only widen_mul/sum don't do that. > > > > I believe type_conversion_p should simply look at the detected pattern, > > thus > > > > Index: tree-vect-patterns.c > > =================================================================== > > --- tree-vect-patterns.c (revision 233418) > > +++ tree-vect-patterns.c (working copy) > > @@ -171,6 +171,13 @@ type_conversion_p (tree name, gimple *us > > if (!*def_stmt) > > return false; > > > > + if (dt == vect_internal_def) > > + { > > + stmt_vec_info def_vinfo = vinfo_for_stmt (*def_stmt); > > + if (STMT_VINFO_IN_PATTERN_P (def_vinfo)) > > + *def_stmt = STMT_VINFO_RELATED_STMT (def_vinfo); > > + } > > + > > if (!is_gimple_assign (*def_stmt)) > > return false; > > > > does that fix it? > > This doesn't work. > > pr69820.c: In function ‘foo’: > pr69820.c:6:1: internal compiler error: in vect_get_vec_def_for_operand, at > tree-vect-stmts.c:1424 > foo (void) > ^~~ > 0x106f8c6 vect_get_vec_def_for_operand(tree_node*, gimple*, tree_node*) > ../../gcc/tree-vect-stmts.c:1424 > 0x1078daf vectorizable_conversion > ../../gcc/tree-vect-stmts.c:4087 > 0x1085da5 vect_transform_stmt(gimple*, gimple_stmt_iterator*, bool*, > _slp_tree*, _slp_instance*) > ../../gcc/tree-vect-stmts.c:8191 > ... > > I think the vectorizer is not prepared to see one pattern seq referencing > SSA_NAME set by a different pattern seq.
Hmm, I think it works in general, but I suspect that the pattern has to use the original def but for out analysis we have to look at the pattern. So another fix would be to simply fail if there was a pattern detected. Richard.