This is the mail archive of the gcc-patches@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]

Re: Fw: [lno] [patch] vectorization with unknown loop bound


Hello,

> The following patch allows vectorizing loops which
> bound is unknown at compile time.
> 
> Loop duplication is used as solution. If original loop was
> executed 'n' iterations, then the first copy of the loop
> (that will be vectorized late) will execute n-n%VF times
> (VF is vectorization factor), while the second copy will remain serial
> and execute n%VF times.
> 
> The function number_of_iterations_in_loop is used.
> Thanks to Sebastian Pop for enhancing it recently to return symbolic values
> (patch http://gcc.gnu.org/ml/gcc-patches/2004-04/msg01797.html).
> 
> I used some static functions from tree-ssa-loop-manip.c and
> cfgloopmanip.c, as well the function force_gimple_operand() from
> tree-ssa-loop-ivopts.c, so I changed these functions to non-static.
> Alternatively it was possible to make this loop transformation
> generic, that is a question whether it is worth doing.

a few notes:

1) The patch is probably not current (force_gimple_operand is already
   exported for some time, for example)
2) The declarations of non-static functions should be placed in header
   files.
3) If I understand correctly, you do something like transforming

for (i = 0; i < n; i++)
  xxx ();

into

for (i = 0; i < n / C; i++)
  xxx ();
for (; i < n; i++)
  xxx ();

Could you please make the function that does this generic, name it
in some sensible way (align_number_of_iterations?) and place it
to tree-ssa-loop-manip.c?  This is likely to decrease the number of
functions you need to export, and more importantly, this operation
is useful also for other optimizations.

4) You do not need to export place_new_loop.

Zdenek


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