This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Variable Expansion Optimization
- From: Revital Eres <ERES at il dot ibm dot com>
- To: gcc at gcc dot gnu dot org
- Cc: Ayal Zaks <ZAKS at il dot ibm dot com>, Mircea Namolaru <NAMOLARU at il dot ibm dot com>
- Date: Sun, 15 Aug 2004 13:20:06 +0300
- Subject: Variable Expansion Optimization
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