This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] Out of SSA status and issues
- From: Diego Novillo <dnovillo at redhat dot com>
- To: Michael Matz <matz at suse dot de>
- Cc: Andrew Macleod <amacleod at redhat dot com>,gcc mailing list <gcc at gcc dot gnu dot org>
- Date: 13 May 2003 09:11:37 -0400
- Subject: Re: [tree-ssa] Out of SSA status and issues
- Organization: Red Hat Canada
- References: <Pine.LNX.4.44.0305131450310.15564-100000@wotan.suse.de>
On Tue, 2003-05-13 at 08:56, Michael Matz wrote:
> Hi,
>
> On 13 May 2003, Diego Novillo wrote:
>
> > Why?
> >
> > 1. foo()
> > 2. {
> > 3. int i, *p;
> > 4.
> > 5. p = malloc();
> > 6. i = *p;
> > 7. return i + 9;
> > 8. }
> >
> > I see nothing wrong in replacing 'i + 9' with '*p + 9'.
>
> I do. *p could have been changed in between 6 and 7.
>
The above is a complete program, *p has not changed between 6 and 7 nor
it is volatile.
> I.e. *p is not a register but an expression, and a copy instruction copies
> registers to registers.
>
Not in tree-ssa. INDIRECT_REFs are first-class variables. Since in
GIMPLE pointers can only be one level deep, we can maintain SSA version
numbers for the pointer and the pointed-to memory location. Granted, it
is somewhat painful (see my other message in this thread) and I'm
starting to think that it may not be sufficiently worth the pain.
> > Not that tree-ssa will do anything with this code, the default
> > type-based aliasing is too conservative, but PTA may disambiguate this.
>
> Of course you _can_ optimize such cases, but it's not a subset of copy
> propagation but, hmm, un-PRE or something like that.
>
It is if INDIRECT_REFs are treated as regular variables, like we
currently do. I agree that otherwise you need to treat them as
expressions. If we stopped dealing with INDIRECT_REFs as first-class
variables, we would probably move this in to the hands of SSAPRE.
Diego.