On Thu, Sep 5, 2013 at 11:43 AM, Bernd Edlinger <bernd.edlin...@hotmail.de> wrote: > On Tue, 3 Sep 2013 10:38:33, Richard Biener wrote: >> I'd rather go with the simple fix as the issue in forwprop is at least >> latent. We can >> improve on the code-gen as followup where I believe handling of >> POINTER_PLUS_EXPR >> would need to be added (that we avoid POINTER_PLUS_EXPR for vectors is a >> bug). >> That can be done in a way to cover the vector case properly. Or >> finally properly >> use POINTER_PLUS_EXPR for vectors or make the vectorizer not use pointer >> types but a corresponding unsigned integer type for them (that would also fix >> the original bug of course). Like with (untested) >> >> Index: gcc/tree-vect-stmts.c >> =================================================================== >> --- gcc/tree-vect-stmts.c (revision 202196) >> +++ gcc/tree-vect-stmts.c (working copy) >> @@ -6179,8 +6179,7 @@ get_vectype_for_scalar_type_and_size (tr >> corresponding to that mode. The theory is that any use that >> would cause problems with this will disable vectorization anyway. */ >> else if (!SCALAR_FLOAT_TYPE_P (scalar_type) >> - && !INTEGRAL_TYPE_P (scalar_type) >> - && !POINTER_TYPE_P (scalar_type)) >> + && !INTEGRAL_TYPE_P (scalar_type)) >> scalar_type = lang_hooks.types.type_for_mode (inner_mode, 1); >> >> /* We can't build a vector type of elements with alignment bigger than >> >> actually that would be my preference here ... > > this would cause an ICE in test case 20000629-1.c...
Well, that's easily fixable. > So removing the pointer of vectors is not an option. Let me nevertheless try this. Richard. >>>> The real fix is of course to make vector pointer operations properly >>>> use POINTER_PLUS_EXPR ... > > Okay I can do what you want, and use POINTER_PLUS_EXPR for > vectors of pointers, and do the constant folding in assocate_pointerplus. > This way we get exactly the same code as before. It may be even possible > that this constant folding can improve something with scalars. > > Bootstrapped and regression tested on x86_64-unknown-linux-gnu. > > OK for trunk? > > Bernd.