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:29:00 -0000	[thread overview]
Message-ID: <1052832579.7945.109.camel@p4> (raw)
In-Reply-To: <1052831126.27232.241.camel@frodo.toronto.redhat.com>

On Tue, 2003-05-13 at 09:05, Diego Novillo wrote:
> On Tue, 2003-05-13 at 08:50, Andrew MacLeod wrote:
> > On Tue, 2003-05-13 at 08:42, Diego Novillo wrote:
> > > On Tue, 2003-05-13 at 05:07, Michael Matz wrote:
> > > 
> > > > An indirect reference is not a copy.  I don't know if tree-ssa thinks it
> > > > is, but it definitely shouldn't.
> > > > 
> > > 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'.  It would
> > > probably not be efficient, but I can't see it being wrong.
> > > 
> > > Not that tree-ssa will do anything with this code, the default
> > > type-based aliasing is too conservative, but PTA may disambiguate this.
> > 
> > There is nothing wrong with it, as long as you know for sure that *p
> > hasn't changed between 'i = *p' and 'i+9'. Copyprop doesnt look for
> > that. All it does is says 'i = *p', I can replace all occurences of i
> > with *p...
> > 

> 
>      1. foo()
>      2. {
>      3.   int *p;
>      4. 
>      5.   p_1 = malloc();
>      6.   p_4 = malloc();
>      7.   return *(p_1)_3 + 9;
>      8. }
> 
> Will the coalescer DTRT here?  Yes, it's a silly transformation, but I'm
> wondering if we don't have a bigger problem here.  I've been toying with

Sure, the coalescer will handle this easily. p_1 and p_4 conflict, so
they will get assigned something like:

p = malloc ()
p.33 = malloc()
return *p + 9


Doesn't make the copy-prop example right tho. If you take the original
case, and use the new format, you'd get:

      #   (*T.6_12)_13 = VDEF <(*T.6)_7>;
      T.6_12 = T.2_8 + T.5_11;

      #   VUSE <T.6_12>;
      i_14 = (*T.6_12)_13       <<<--- This is an issue.... 

      #   (*T.6_12)_22 = VDEF <(*T.6_12)_13>      
      #   VUSE <T.6_12>
      *T.6_12 = 30;
    };
  #   i_1 = PHI <i_6(0), (*T.6_12)_13(1)>;
 

Since the point itself never changes (just the memory), It would still
be written out the same way, and be wrong.

The stmt I flagged with "This is an issue", IMHO should actually be:
  i_14 = *T.6_12

I don't think it should have the _13. And of course, the VUSE shouldn't
be there since T.6_12 is now a real use. In fact, the aliased variable
should be a VUSE... so I think it ought to look like:

   #   VUSE <(*T.6_12)_13>
   i_14 = *T.6_12

I think that is consistant..... Virtual variables used for aliasing,
real variables used for code.

Andrew

> the idea of not bothering with renaming INDIRECT_REFs *at all*.  We
> certainly get little benefit from it because they are often aliased and
> it really is somewhat painful to deal with them.
> 

Well, renaming of indirect refs serves a different purpose.. we dont use
them when we are rewriting out of SSA form, but I suspect anyone who
tries to manipulate loads and stores is going to want them, because they
effectively give versions to loads and stores, allowing you to use SSA
on memory references... 

But I could be imagining things :-)

The above exmaple seems to make it pretty clear that the value of
(*T.6_12) is different when we set *T.6_12 = 30.  Perhaps there is a
better way.   You simply cannot "use" (*T.6_12)_13 any more, because the
memory it refers to has now changed... 

Whats PRE think of all this?

Andrew.  






  reply	other threads:[~2003-05-13 13:29 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 [this message]
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
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=1052832579.7945.109.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).