double a[16][64], y[64], x[16]; void foo(void) { int i, j; for (j = 0; j < 64; ++j) for (i = 0; i < 16; ++i) y[j] = y[j] + a[i][j] * x[i]; }
PRE moves the load of y[j] out of the inner loop like pretmp = y[j]; for (i = 0; i < 16; ++i) { D.xxx = pretmp + a[i][j] * x[i]; storetmp = D.xxx; y[j] = storetmp; } which makes loop store motion no longer apply (store sinking is too broken to fix this as well). -- Summary: PRE causes missed loop store motion, store sinking doesn't work Product: gcc Version: 4.4.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rguenth at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36009