https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117888
Bug ID: 117888 Summary: cunrolli doesn't accurately remember what's "innermost" Product: gcc Version: 15.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: liuhongt at gcc dot gnu.org Target Milestone: --- > > that's the r15-919-gef27b91b62c3aa change I think. The heuristic, while > careful, doesn't accurately remember what's "innermost" in this case > though it's still correct that the body isn't simplified by 1/3 - in I also notice another testcase which has similar issue, it takes innermost as an outerloop. typedef struct { double real; double imag; } complex; typedef struct { complex e[3][3]; } su3_matrix; void mult_su3_nn( su3_matrix *a, su3_matrix *b, su3_matrix *c ) { int i,j; double t,ar,ai,br,bi,cr,ci; for(i=0;i<3;i++)for(j=0;j<3;j++){ ar=a->e[i][0].real; ai=a->e[i][0].imag; br=b->e[0][j].real; bi=b->e[0][j].imag; cr=ar*br; t=ai*bi; cr -= t; ci=ar*bi; t=ai*br; ci += t; ar=a->e[i][1].real; ai=a->e[i][1].imag; br=b->e[1][j].real; bi=b->e[1][j].imag; t=ar*br; cr += t; t=ai*bi; cr -= t; t=ar*bi; ci += t; t=ai*br; ci += t; ar=a->e[i][2].real; ai=a->e[i][2].imag; br=b->e[2][j].real; bi=b->e[2][j].imag; t=ar*br; cr += t; t=ai*bi; cr -= t; t=ar*bi; ci += t; t=ai*br; ci += t; c->e[i][j].real=cr; c->e[i][j].imag=ci; } }