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)


Jakub Jelinek <jakub@redhat.com> writes:

> On Tue, Oct 03, 2006 at 02:06:37PM -0400, Diego Novillo wrote:
> > Eric Botcazou wrote on 10/03/06 14:02:
> > >> That should suffice for the TBAA alias checks done at the RTL level.
> > >> The tree level doesn't check the alias set, but presumably we can do
> > >> something similar if necessary.
> > > 
> > > TYPE_REF_CAN_ALIAS_ALL works both at the Tree and the RTL level.
> > > 
> > But you don't want to punish all the pointers of that type.  Unless, a
> > new type was created for that pointer.  DECL_POINTER_ALIAS_SET may be
> > good enough.
> 
> I tried:

...

> but in all testcases I tried the ref_all pointer was very quickly
> optimized away.

This test case works correctly, in that the store through char*
affects the load:

int
foo (int *p)
{
  char* pc;

  *p = 1;
  pc = (char *) p;
  pc[0] = 2;
  return *p;
}

In this very similar test case, the store through the short* does not
affect the load:

int
foo (int *p)
{
  short* pc;

  *p = 1;
  pc = (short *) p;
  pc[0] = 2;
  return *p;
}

So gcc is able to make the distinction that we want it to make, and my
logic says that we must be able to do the same thing when handling
memcpy.

Ian


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