This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix the one entry mem{{,p}cpy,move,set} optimization aliasing issues (PR middle-end/29272)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]