This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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








Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]