Loop Rewind - Infinite Loop

Description

This message reports that the code is preventing the loop merging optimization.

Explanation

Multiple sequential loops can create additional latency moving from one loop to another loop. In these scenarios, the compiler can help to optimize by merging the sequential loops.

These loops should not include any non-trivial code.

The following code shows a violation of loop merging.

void top (a[4],b[4],c[4],d[4], var, ot...) {
...
Add: for (i=3;i>=0;i--) { if (d[i])
a[i] = b[i] + c[i]; }
// non-trivial code.
int h = var*a[0]*ot;
Sub: for (i=3;i>=0;i--) { if (!d[i])
a[i] = b[i] - c[i] +h ; }
...
}

Solution

Consider moving the code inside the for loop.