https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97334
Bug ID: 97334 Summary: inefficient vectorization of gcc.dg/vect/bb-slp-pr65935.c Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: rguenth at gcc dot gnu.org Target Milestone: --- For void rephase (void) { int i,j,k,dir; struct site *s; for(i=0,s=lattice;i<sites_on_node;i++,s++) for(dir=0;dir<32;dir++) for(j=0;j<3;j++)for(k=0;k<3;k++) { s->link[dir].e[j][k].real *= s->phase[dir]; s->link[dir].e[j][k].imag *= s->phase[dir]; } where SLP faces unrolled j and k loops we fail to vectorize the loads of { s->link[dir].e[j][k].real, s->link[dir].e[j][k].imag } because SLP discovery rejects the s->phase[dir] load: /home/rguenther/src/gcc3/gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c:28:30: note: Build SLP for _59 = s_8->phase[dir_80]; /home/rguenther/src/gcc3/gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c:28:30: missed: Build SLP failed: unvectorizable statement _59 = s_8->phase[dir_80]; /home/rguenther/src/gcc3/gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c:28:30: note: Building vector operands from scalars /home/rguenther/src/gcc3/gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c:28:30: note: Build SLP for _59 = s_8->phase[dir_80]; /home/rguenther/src/gcc3/gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c:28:30: missed: Build SLP failed: unvectorizable statement _59 = s_8->phase[dir_80]; /home/rguenther/src/gcc3/gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c:28:30: note: Building vector operands from scalars and then ends up building the multiplication operands from scalars: /home/rguenther/src/gcc3/gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c:28:30: note: node 0x4a36cb0 (max_nunits=2, refcnt=2) /home/rguenther/src/gcc3/gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c:28:30: note: stmt 0 _60 = _58 * _59; .. /home/rguenther/src/gcc3/gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c:28:30: note: children 0x4931310 0x4a6e690 /home/rguenther/src/gcc3/gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c:28:30: note: node (external) 0x4931310 (max_nunits=1, refcnt=1) /home/rguenther/src/gcc3/gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c:28:30: note: { _58, _59, _59, _59, _59, _59, _59, _59, _59, _59, _59, _59, _59, _59, _59, _59, _59, _59 } /home/rguenther/src/gcc3/gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c:28:30: note: node (external) 0x4a6e690 (max_nunits=1, refcnt=1) /home/rguenther/src/gcc3/gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c:28:30: note: { _59, _62, _65, _68, _71, _74, _82, _86, _89, _92, _95, _98, _106, _110, _113, _116, _119, _122 }