Message ID | CAFiYyc3H-+4mdm-Oi6MaLuikZzzrPmEnCZc23q3GBoECFMmCWw@mail.gmail.com |
---|---|
State | New |
Headers | show |
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... So removing the pointer of vectors is not an option. >>> 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. 2013-09-05 Bernd Edlinger <bernd.edlinger@hotmail.de> PR tree-optimization/58137 Use POINTER_PLUS_EXPR for vector of pointer additions. * tree-cfg.c (verify_gimple_assign_binary) <PLUS_EXPR, MINUS_EXPR>: Remove vector of pointer handling. <POINTER_PLUS_EXPR>: Add vector of pointer type check. * tree.c (build2_stat) <POINTER_PLUS_EXPR>: Allow vector of pointer. * tree-vect-stmts.c (vectorizable_operation): Do not replace POINTER_PLUS_EXPR with PLUS_EXPR. * tree-vect-loop.c (get_initial_def_for_induction): Use POINTER_PLUS_EXPR for vector of pointer. testsuite: * gcc.target/i386/pr58137.c: New test.
On Thu, Sep 5, 2013 at 11:43 AM, Bernd Edlinger <bernd.edlinger@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.
On Thu, 5 Sep 2013 12:25:08, Richard Biener wrote: > On Thu, Sep 5, 2013 at 11:43 AM, Bernd Edlinger > <bernd.edlinger@hotmail.de> wrote: >> >> 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. Very well, then you continue on this PR and I'll come back later with a follow up patch. Bernd.
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