Variable Expansion Optimization
Revital Eres
ERES@il.ibm.com
Sun Aug 15 11:25:00 GMT 2004
Hello,
I intend to implement variable expansion
in the body of the unrolled loop.
For example, consider the following loop
which contains an accumulator:
for (i = 0 ; i < n; i++)
sum += a[i];
After the unrolling we get the following code:
sum += a[i];
....
i = i+1;
sum += a[i];
....
i = i+1
sum += a[i];
....
The variable expansion optimization will expand the variable
sum into n separate copies, one for each copy of the loop body
and combine them at the loop exit:
sum += a[i]
....
i = i+1;
sum1 += a[i]
....
i = i+1
sum2 += a[i];
....
This transformation decreases the number of dependences
in the loop, thus making instruction scheduling
more effective when applied on it.
In the implementation I intend to use the
framework introduced in the patch for splitting induction
variables in unroller-
http://gcc.gnu.org/ml/gcc-patches/2004-08/msg00397.html
Comments are welcome.
Thanks,
Revital
More information about the Gcc
mailing list