This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix the one entry mem{{,p}cpy,move,set} optimization aliasing issues (PR middle-end/29272)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Eric Botcazou <ebotcazou at adacore dot com>
- Cc: Diego Novillo <dnovillo at redhat dot com>, Ian Lance Taylor <iant at google dot com>, gcc-patches at gcc dot gnu dot org
- Date: Wed, 4 Oct 2006 07:19:07 -0400
- Subject: Re: [PATCH] Fix the one entry mem{{,p}cpy,move,set} optimization aliasing issues (PR middle-end/29272)
- References: <20060929075035.GQ20982@devserv.devel.redhat.com> <4522A6AD.9030802@redhat.com> <20061004103859.GS20982@devserv.devel.redhat.com> <200610041253.41407.ebotcazou@adacore.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, Oct 04, 2006 at 12:53:41PM +0200, Eric Botcazou wrote:
> > I tried:
> >
> > --- builtins.c.jj 2006-10-04 10:59:46.000000000 +0200
> > +++ builtins.c 2006-10-04 11:52:29.000000000 +0200
> > @@ -7995,7 +7995,7 @@ fold_builtin_bzero (tree arglist, bool i
> > static tree
> > fold_builtin_memory_op (tree arglist, tree type, bool ignore, int endp)
> > {
> > - tree dest, src, len, destvar, srcvar, expr;
> > + tree dest, src, len, destvar, srcvar, expr, desttype, srctype;
> > unsigned HOST_WIDE_INT length;
> >
> > if (! validate_arglist (arglist,
> > @@ -8059,6 +8059,18 @@ fold_builtin_memory_op (tree arglist, tr
> > < (int) length)
> > return 0;
> >
> > + desttype = build_pointer_type_for_mode (TREE_TYPE (destvar),
> > + ptr_mode, true);
> > + destvar = build_fold_addr_expr (destvar);
> > + destvar = fold_convert (desttype, destvar);
> > + destvar = build1 (INDIRECT_REF, TREE_TYPE (desttype), destvar);
>
> What tree do you get at this point?
When I use just build1 rather than fold_build_indirect_ref I get the IMHO
right one:
;; Function foo (foo)
;; enabled by -tree-original
{
struct T * p = (struct T *) s;
struct T * p = (struct T *) s;
*(struct T * * {ref-all}) &p->t = *(struct T * * {ref-all}) &t.t;, (void *) &p->t;;
}
for the 29272 testcase. But already at *.gimple that's bad again:
foo (s)
{
struct T * D.1530;
struct T * p;
p = (struct T *) s;
D.1530 = t.t;
p->t = D.1530;
}
and no ref-all in sight.
Jakub