Scheduling an early complete loop unrolling pass?

Richard Guenther rguenther@suse.de
Mon Feb 5 15:57:00 GMT 2007


On Mon, 5 Feb 2007, Paolo Bonzini wrote:

> 
> > As we also only vectorize innermost loops I believe doing a
> > complete unrolling pass early will help in general (I pushed
> > for this some time ago).
> > 
> > Thoughts?
> 
> It might also hurt, though, since we don't have a basic block vectorizer.
> IIUC the vectorizer is able to turn
> 
>   for (i = 0; i < 4; i++)
>     v[i] = 0.0;
> 
> into
> 
>   *(vector double *)v = (vector double){0.0, 0.0, 0.0, 0.0};

That's true.  But we can not do constant propagation out of this
(and the vectorizer leaves us with a lot of cruft which is only
removed much later).

The above case would also ask for an early vectorization pass if the
loop was wrapped into another.

Finding a good heuristic for which loops to completely unroll early
is not easy, though for odd small numbers of iterations it is
probably always profitable.

Richard.

-- 
Richard Guenther <rguenther@suse.de>
Novell / SUSE Labs



More information about the Gcc mailing list