This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch 1/2] PR27313 Discover non-trapping memory accesses
On Mon, Apr 16, 2007 at 06:51:25PM +0200, Michael Matz wrote:
> The plan in any case was, to only note stores as shadowing other
> accesses.
Ah. That would indeed simplify the problem.
> I'm not sure if we ever are allowed to reorder stores,
> generally we are not.
One transformation to think of there is store promotion.
*p = x
y = *p
*p = z [notrap]
=>
t = x;
y = t;
*p = z;
If we're not careful, we might leave the notrap flag set
in the store of z.
> I also have a hard time to imagine a usefull transformation where a load
> is moved in front of a dominating load, but that dominating load itself is
> not moved.
One thing we'd really want to do with this transformation is
to promote *any* reference though a pointer as non-trapping. So
x = p->x [trap]
y = p->y [notrap]
This isn't what your current code does, so your current code doesn't
have to consider it, but it would be extremely useful for Java. With
such a transformation, it's easy to imagine Y being moved around the
dominator tree independently of X.
r~