https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101280

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-07-01

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
void dummy (double *, double *);
#define LEN_2D 32
double aa[LEN_2D][LEN_2D], bb[LEN_2D][LEN_2D];
double s231(int iterations)
{
//    loop interchange
//    loop with data dependency
    for (int nl = 0; nl < 100*(iterations/LEN_2D); nl++) {
        for (int i = 0; i < LEN_2D; ++i) {
            for (int j = 1; j < LEN_2D; j++) {
                aa[j][i] = aa[j - 1][i] + bb[j][i];
            }
        }
        dummy(aa[0],bb[0]);
    }
}

compiles and

> gcc-11 t.c -O3 -fopt-info-loop -S
t.c:9:27: optimized: loops interchanged in loop nest
t.c:10:31: optimized: loop vectorized using 16 byte vectors
t.c:4:8: optimized: loop with 15 iterations completely unrolled (header
execution count 33608120)

while trunk only vectorizes.

Reply via email to