public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew MacLeod <amacleod@redhat.com>
To: Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
Cc: Jeff Law <law@redhat.com>, Diego Novillo <dnovillo@redhat.com>,
	gcc mailing list <gcc@gcc.gnu.org>
Subject: Re: [tree-ssa] Lazy updating of stmt operands
Date: Mon, 15 Dec 2003 19:10:00 -0000	[thread overview]
Message-ID: <1071515090.3354.1681.camel@p4> (raw)
In-Reply-To: <20031211223056.GA20061@atrey.karlin.mff.cuni.cz>

On Thu, 2003-12-11 at 17:30, Zdenek Dvorak wrote:
> Hello,
> 
> >  >> > tree-dfa.c:compute_immediate_uses()
> >  >> 
> >  >> Which needs to pass through every single statement in the program. Not
> >  >> really terribly efficient.
> >  >> 
> >  >*shrug*, it's used by SSA-CCP.  Since def-use edges are only needed by
> >  >some passes, I don't think it would be worth our while trying to
> >  >maintain them in get_stmt_operands.

> here is the patch.  It increases time for compiling preprocessed gcc
> sources from 3m43.734s to 3m47.967s.  It does not use interface of
> immediate uses, since that is not well suited for updating; instead it
> just keeps lists of uses for each ssa name.  The old interface and ccp
> that uses it are not changed by the patch, so in fact the cost would
> be a bit smaller.

Why isn't it well suited for updating? The information is in the
defining stmt's annotation, so given any SSA variable, you can get to
the immediate uses by looking at the annotation for SSA_NAME_DEF_STMT.
It needs a marginal extention to deal with the fact that there can be
multiple defs/vdefs on one stmt, but we need to do that to handle
virtual defs anyway.  I would prefer to keep this information right with
the stmt rather than in a table on the side.

Diego, default defs have a (void *)0 stmt, but we can still attach a
stmt annotation to them right? (ie, they arent shared) We need to be
able to, so you better say yes :-)

> 
> It turned out to be simpler not to require the immediate uses to be
> updated all the time; just to keep the list of statements that were
> modified and to update it when get_stmt_operands is called.
> 

Indeed, I think we *have* to maintain some laziness about the way stmts
are updated. Otherwise if you copy the use of a variable and change it
to a new ssa version  before you copy/create the feeding defintion, its
hard to get it right. 

The tricky part is undoing what the stmt use to do when its been
modified. We have the operand cache, but it points at what *use* to be
in the stmt, and that may have potentially been free'd and re-alloced,
or reused for something else.  There are many places where we simply
change the operand and mark the stmt as modified.

We can fix that by extending the information slightly in the data flow
structure to include a reference to what ssa name the data relates to,
but thats reasonably trivial.

I'll think about it over the holidays, it should be possible to provide
lazy updates of the information for whatever variables are present
without too much trouble.  It should tie in nicely with the new operands
work Ive been doing.

> The cost is not insignificant, so we probably don't want to do this
> unless I am able to cut it down or we really need it.

You will find it much cheaper if you only include the specific variables
you are interested in, as CCP does.



Andrew

  parent reply	other threads:[~2003-12-15 19:05 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-07 16:22 Zdenek Dvorak
2003-12-07 17:14 ` Diego Novillo
2003-12-07 17:28   ` Zdenek Dvorak
2003-12-07 17:36     ` Diego Novillo
2003-12-07 18:09       ` Zdenek Dvorak
2003-12-11 19:39         ` law
2003-12-07 22:20       ` Steven Bosscher
2003-12-09 14:30         ` Andrew MacLeod
2003-12-09 20:40           ` Zdenek Dvorak
2003-12-11 19:41           ` law
2003-12-11 19:38       ` law
2003-12-11 19:52         ` Zdenek Dvorak
2003-12-11 22:36         ` Zdenek Dvorak
2003-12-11 23:34           ` Andrew MacLeod
2003-12-15 19:10           ` Andrew MacLeod [this message]
2003-12-15 19:19             ` Zdenek Dvorak
2003-12-15 20:55               ` Andrew MacLeod
2003-12-15 21:06                 ` Zdenek Dvorak
2003-12-15 21:39                   ` Andrew MacLeod
2003-12-15 21:49                     ` Zdenek Dvorak
2003-12-15 22:04                       ` Andrew MacLeod
2003-12-15 22:39                         ` law
2003-12-17  4:56                       ` law
2003-12-16 23:32               ` Andrew MacLeod
2003-12-17  0:09                 ` Zdenek Dvorak
2003-12-17  0:21                   ` Andrew MacLeod
2003-12-17  3:28                 ` law
2003-12-15 19:28             ` Diego Novillo
2003-12-11 22:31 Chris Lattner
2003-12-12  3:14 ` law
2003-12-12  3:58   ` Chris Lattner
2003-12-12 19:25     ` Andrew MacLeod
2003-12-12 19:42       ` Zdenek Dvorak
2003-12-12 19:45         ` Andrew MacLeod
2003-12-12 19:54           ` Chris Lattner
2003-12-12 19:55             ` Andrew MacLeod
2003-12-12 21:26               ` Diego Novillo
2003-12-12 19:57       ` Chris Lattner
2003-12-13 16:02         ` Andrew MacLeod
2003-12-14  3:39           ` Chris Lattner
2003-12-15 23:41           ` law
2003-12-16  6:02             ` Andrew MacLeod
2003-12-15 20:47 Chris Lattner

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=1071515090.3354.1681.camel@p4 \
    --to=amacleod@redhat.com \
    --cc=dnovillo@redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=law@redhat.com \
    --cc=rakdver@atrey.karlin.mff.cuni.cz \
    /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).