public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew MacLeod <amacleod@redhat.com>
To: Diego Novillo <dnovillo@redhat.com>
Cc: Michael Matz <matz@suse.de>, gcc mailing list <gcc@gcc.gnu.org>
Subject: Re: [tree-ssa] Out of SSA status and issues
Date: Tue, 13 May 2003 13:18:00 -0000	[thread overview]
Message-ID: <1052831908.8201.96.camel@p4> (raw)
In-Reply-To: <1052831496.27232.247.camel@frodo.toronto.redhat.com>

On Tue, 2003-05-13 at 09:11, Diego Novillo wrote:
> 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.
> 

but you are missing the point. There are lots of trivial examples which
dont show problems.

The problem occurs when yoiu add a new stmt, 6.5 *p = 10

copyprop still thinks it can propagate the stmt, but it can't.

*p = 10 is not a co[py. It is a store to memory, and you have to go
looking at aliasing and such in order to move around loads. copy prop
doesnt do that.

> > 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.
> 

I think the only issue is that the copy prop pass is incorrectly
assuming that a load from memory through a pointer is the same thing as
a copy between variables, and it isn't.

Andrew


  reply	other threads:[~2003-05-13 13:18 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-12 14:42 Andrew MacLeod
2003-05-12 15:38 ` Diego Novillo
2003-05-12 15:57   ` Andrew MacLeod
2003-05-12 16:05     ` Michael Matz
2003-05-12 16:10       ` Andrew MacLeod
2003-05-12 16:16       ` law
2003-05-12 17:08     ` law
2003-05-12 17:12       ` Andrew MacLeod
2003-05-12 17:26         ` law
2003-05-12 18:57 ` Andrew MacLeod
2003-05-13  9:07   ` Michael Matz
2003-05-13 12:42     ` Diego Novillo
2003-05-13 12:50       ` Andrew MacLeod
2003-05-13 13:05         ` Diego Novillo
2003-05-13 13:29           ` Andrew MacLeod
2003-05-13 13:57             ` Diego Novillo
2003-05-13 12:57       ` Michael Matz
2003-05-13 13:11         ` Diego Novillo
2003-05-13 13:18           ` Andrew MacLeod [this message]
2003-05-14 17:19             ` Jan Vroonhof
2003-05-14 18:05               ` Andrew MacLeod
2003-05-14 18:33               ` Diego Novillo
2003-05-14 19:11                 ` Daniel Berlin
2003-05-13 15:01         ` Daniel Berlin
2003-05-13 12:33   ` Diego Novillo
2003-05-13 12:49     ` Andrew MacLeod
2003-05-13 12:58       ` Diego Novillo
2003-05-13 13:17 Richard Kenner
2003-05-13 13:27 ` Diego Novillo
2003-05-13 13:40 ` Michael Matz
2003-05-13 15:08 ` Michael S. Zick
2003-05-13 13:42 Richard Kenner
2003-05-13 15:23 Richard Kenner
2003-05-13 18:50 ` Geoff Keating
2003-05-13 23:28   ` Michael S. Zick
2003-05-17 17:19 ` Michael S. Zick

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1052831908.8201.96.camel@p4 \
    --to=amacleod@redhat.com \
    --cc=dnovillo@redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=matz@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).