Example: see the following code,
int x = 2;
int y = 3;
int *array[5];
for (i=0; i<5;i++)
*array[i] = x + y;
Because x and y are invariant and do not change inside of the loop, their addition doesn't need to be performed for each loop iteration. Almost any good compiler optimizes the code. An optimizer moves the addition of x and y outside the loop, thus creating a more efficient loop. Thus, the optimized code in this case could look like the following:
int x = 5;
int y = 7;
int z = x + y;
int *array[10];
for (i=0; i<5;i++)
*array[i] = z;