On Mon, Jan 13, 2014 at 02:37:38PM +0100, Richard Biener wrote: > 2014-01-13 Richard Biener <rguent...@suse.de> > > PR tree-optimization/58921 > PR tree-optimization/59006 > * tree-vect-loop-manip.c (vect_loop_versioning): Remove code > hoisting invariant stmts. > * tree-vect-stmts.c (vectorizable_load): Insert the splat of > invariant loads on the preheader edge if possible. > > * gcc.dg/torture/pr58921.c: New testcase. > * gcc.dg/torture/pr59006.c: Likewise. > * gcc.dg/vect/pr58508.c: XFAIL no longer handled cases.
Looks good to me. If you want, I can add another bool to loop_vinfo, which would say if in the vectorized loop could be aliasing preventing the hoisting (i.e. set to false always, unless the loop->simdlen > 0, when it would be set if we would without loop->simdlen > 0 use versioning for alias or punting, but loop->simdlen > 0 resulted in vectorization of the loop anyway). Then, as a follow-up we could use that predicate instead of LOOP_REQUIRES_VERSIONING_FOR_ALIAS in vectorizable_load. Jakub