IMA vs tree-ssa
Geoff Keating
geoffk@desire.geoffk.org
Fri Apr 2 18:18:00 GMT 2004
> From: Dale Johannesen <dalej@apple.com>
> Date: Thu, 1 Apr 2004 16:53:54 -0800
...
> Indeed when I wrote this the only examples I could construct used
> multiple
> files and IMA. But see Joseph Myers' response for a single-file case.
Yes, Joseph's example is good.
> >> This is not undefined behavior, and the standard says that p and q
> >> don't alias in foo.
> >
> > It does, that it says that if you write
> >
> > p = &x;
> > q = &y;
> >
> > then you can interchange those two assignments. It does not, however,
> > say that *p and *q don't alias.
>
> Restricting p and q to be non-char, it does; *p and *q have
> non-compatible types.
They have non-compatible types with each other, but that's not the
test for whether two things can't alias; the standard talks about the
'effective type of the object'. So two accesses can alias if there
could be a type which is compatible with both of the types involved,
even if the two types are not themselves compatible. If you can work
out what the object's effective type is (which is not always possible
at compile time, since it's a run-time property) then you could test
for compatibility with that, which would be a more precise test.
I don't think this will hurt optimisation much. The cases involved
are not common. It's annoying to code, though.
--
- Geoffrey Keating <geoffk@geoffk.org>
More information about the Gcc
mailing list