public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Daniel Berlin <dberlin@dberlin.org>
To: Diego Novillo <dnovillo@redhat.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
	Andrew Macleod <amacleod@redhat.com>
Subject: Re: [PATCH]: Implement must-def kill operand
Date: Wed, 20 Oct 2004 18:28:00 -0000	[thread overview]
Message-ID: <C69F1F35-22C4-11D9-B310-000D93B1B044@dberlin.org> (raw)
In-Reply-To: <1098294982.22552.38.camel@localhost.localdomain>


On Oct 20, 2004, at 1:56 PM, Diego Novillo wrote:

> On Wed, 2004-10-20 at 13:53, Daniel Berlin wrote:
>
>> I assume nobody really had much problem with the *other* parts of the
>> patch?
>>
> The rest looked OK to me.  It was just the needed mechanical changes to
> support an RHS in V_MUST_DEFs.
>

Actually, we forgot a part.
Currently, all arguments used in v_must_def rhs's are marked as 
unnecessary.

This is done so that

<maybe_dead statement>
<dead_statement>
<use of dead statement result in v_must_def>

Doesn't result in dead statement being kept alive.

However, if the result of dead-statement is a phi node, the phi node 
itself may need to be kept alive (but not it's feeding statements).
p_9 == default_def here
I've elided the non-p, non def'ing p statements.


# BLOCK 2
# PRED: 6 [64.6%]  (true) 3 [89.0%]  (dfs_back,true)
# p_2 = PHI <p_17(3), p_9(6)>;
<L1>:;
#   p_15 = V_MUST_DEF <p_2>;
   p = D.4836_14;
#   p_17 = V_MAY_DEF <p_15>;
   f_11 ();
# SUCC: 3 [100.0%]  (fallthru)

# BLOCK 3
# PRED: 2 [100.0%]  (fallthru)
   <L5>:;
#   VUSE <p_17>;
   p.25_24 = p;
...
# SUCC: 4 [11.0%]  (loop_exit,false) 2 [89.0%]  (dfs_back,true)


# BLOCK 6
# PRED: 1 [100.0%]  (fallthru)
<L6>:;
#   VUSE <p_9>;
p.25_29 = p;
# SUCC: 2 [64.6%]  (true) 4 [35.4%]  (false)


Because no  kill operands are marked as necessary, dce decides p_2 is 
dead.
But p_2 is necessary, because it's arguments aren't dead, so we have 
nothing to put in the RHS of the kill otherwise.
It's just that the only use of p_2 is in a must-def rhs.
If we let DCE delete that phi, the renamer will put it back, because 
it's necessary to rename the rhs of the must_def.
So we have a couple of options for handling this:

1. Do a quick propagation pass in DCE to make sure def-def phis that 
are used in necessary statements don't die. (at that point, plain 
def-def renaming will work)
2. Mark the must-def operand as necessary if it's a phi, and the only 
immediate use of the phi is in the must-def operand (I'm assuming it 
could appear in a may-def or vuse somewhere else, in which case it's 
necessary).
3. Use the full renamer, which will simply put the phi back after DCE 
removes it.

Welcome to the beginning of the circle again :)
--Dan

  reply	other threads:[~2004-10-20 18:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-18  2:29 Daniel Berlin
2004-10-20 17:41 ` Diego Novillo
2004-10-20 17:56   ` Daniel Berlin
2004-10-20 18:08     ` Diego Novillo
2004-10-20 18:28       ` Daniel Berlin [this message]
2004-10-20 20:36         ` Diego Novillo
2004-10-20 20:49           ` Daniel Berlin
2004-10-20 20:57             ` Diego Novillo
2004-10-20 21:01               ` Daniel Berlin
     [not found]               ` <531813B6-22DA-11D9-B310-000D93B1B044@dberlin.org>
2004-10-20 21:04                 ` Diego Novillo
2004-10-20 21:27                   ` Daniel Berlin
2004-10-20 22:23 ` Andrew Pinski
2004-10-23  5:02   ` Mark Mitchell
2004-10-23 12:56     ` Diego Novillo

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=C69F1F35-22C4-11D9-B310-000D93B1B044@dberlin.org \
    --to=dberlin@dberlin.org \
    --cc=amacleod@redhat.com \
    --cc=dnovillo@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /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).