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)


> The problem is that the tree optimizers often optimize the ref_all types
> out.

That's not accurate.  The optimizer will optimize any useless dereference, 
whatever stuff you put on the pointer, since it knows where the pointer 
points to.

> Last mail on this was Eric suggesting to put the REF_ALL on 
> the inner pointer rather than outer, if that results in alias set
> 0 on the access, that surely could help in some cases to not loose
> that REF_ALL types,

You need to put ref_all on the pointer that makes the problematic memory 
access, not on an artificial one created to hide the aliasing violation.

> but I don't see what e.g. prevents the optimization 
> to be done when we have
>   p = &q->t;
>   ...
>   p0 = (ref_all) p; /* These two stmts come from __builtin_memcpy folding. 
>   p0->s = x;
> and later on some other pass notices that p is &q->t and optimizes
> that into q->t.s = x;

Where's the problem here?  You need a latent aliasing violation in the code.

-- 
Eric Botcazou


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