markus@x4 skia % cat test.ii struct A { int m_fn1 (); short *m_fn2 (); }; struct B { void *fC; }; int a, b; unsigned char i; void fn1 (unsigned char *p1, A &p2) { int c = p2.m_fn1 (); for (int d = 0; c; d++) { short *e = p2.m_fn2 (); unsigned char *f = &p1[0]; for (int g = 0; g < a; g++) { int h = e[0]; b += h * f[g]; } } } void fn2 (A &p1, A &p2, B &p3) { int j = p2.m_fn1 (); for (int k = 0; j; k++) if (0) ; else fn1 (&i, p1); if (p3.fC) ; else ; } markus@x4 skia % g++ -c -O3 test.ii test.ii: In function ‘void fn2(A&, A&, B&)’: test.ii:27:6: internal compiler error: in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1449 void fn2 (A &p1, A &p2, B &p3) ^ Please submit a full bug report,
Confirmed.
Started with r209524.
Created attachment 32668 [details] The patch to fix PR60896 The reason of this issue is that those statements in PATTERN_DEF_SEQ in pre-recognized widen-mult pattern are not forwarded to later recognized dot-product pattern. I have created a patch to fix this. Another issue is that the def types of statements in PATTERN_DEF_SEQ are assigned with the def type of the pattern statement. This is incorrect for reduction pattern statement, in which case all statements in PATTERN_DEF_SEQ will all be vect_reduction_def, and none of them will be vectorized later. The def type of statement in PATTERN_DEF_SEQ should always be vect_internal_def. This patch will also be submitted to gcc-patch.
Author: congh Date: Fri Apr 25 00:20:44 2014 New Revision: 209773 URL: http://gcc.gnu.org/viewcvs?rev=209773&root=gcc&view=rev Log: 2014-04-24 Cong Hou <congh@google.com> PR tree-optimization/60896 * tree-vect-patterns.c (vect_recog_dot_prod_pattern): Pick up all statements in PATTERN_DEF_SEQ in recognized widen-mult pattern. (vect_mark_pattern_stmts): Set the def type of all statements in PATTERN_DEF_SEQ as vect_internal_def. 2014-04-24 Cong Hou <congh@google.com> PR tree-optimization/60896 * g++.dg/vect/pr60896.cc: New test. Added: trunk/gcc/testsuite/g++.dg/vect/pr60896.cc Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-vect-patterns.c
Fixed. Thanks.