This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fw: [lno] [patch] vectorization with unknown loop bound
- From: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- To: Olga Golovanevsky <OLGA at il dot ibm dot com>
- Cc: Devang Patel <dpatel at apple dot _com>,Sebastian Pop <sebastian dot pop at cri dot ensmp dot fr>,Dorit Naishlos <DORIT at il dot ibm dot com>, gcc-patches at gcc dot gnu dot org
- Date: Mon, 17 May 2004 21:21:11 +0200
- Subject: Re: Fw: [lno] [patch] vectorization with unknown loop bound
- References: <OF8E368AD4.1F723576-ONC2256E97.004574A6-C2256E97.004DE384@il.ibm.com>
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