public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Michael Matz <matz@suse.de>
To: trevor_smigiel@playstation.sony.com
Cc: Tehila Meyzels <TEHILA@il.ibm.com>,
	gcc-patches@gcc.gnu.org, 	gcc@gcc.gnu.org,
	Devang Patel <dpatel@il.ibm.com>,
		Dorit Nuzman <dorit@il.ibm.com>, Ayal Zaks <zaks@il.ibm.com>
Subject: Re: [RFC] Improve Tree-SSA if-conversion - convergence of efforts
Date: Thu, 13 Sep 2007 09:58:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.64.0709131147310.23011@wotan.suse.de> (raw)
In-Reply-To: <20070912214828.GI22763@playstation.sony.com>

Hi,

On Wed, 12 Sep 2007, trevor_smigiel@playstation.sony.com wrote:

> I haven't looked at the tree-SSA if-convert code yet, but based on what 
> was described to me at the summit it seemed to be taking the same 
> approach as the RTL pass.  Recognize certain patterns and convert it.
> 
> I would like to see an approach that is able to take an arbitrary flow 
> graph without backedges and convert it to straight line code, limited 
> only by the cost model and impossible cases (e.g., inline asm).
> 
> I'm not sure how that would be achieved in a target neutral way.

By extending GIMPLE to introduce conditional statements, ala:

(pred) STMT

where pred would be a boolean SSA name, with the obvious semantics.  It is 
possible that it's required to limit the forms of STMT allowed to be 
conditional.  For instance to not be stores or calls (generally no VDEFs), 
as that requires phi-nodes for the virtual ops, which would complicate our 
life pretty much, as currently phis can't be placed inside the insn 
stream.  Normal SSA names as target are no problem, as PHI nodes for those 
can be converted to simple select instructions on the same predicate.  
E.g. when we currently have this code:

if (cond) goto L2 else goto L1
L1:
  x_2 = bla
L2:
  # x_3 = PHI<x_1, x_2>
  ...

can be converted to

(cond) x_2 = bla
x_3 = (!cond) ? x_2 : x_1

It's obvious that this doesn't necessarily is profitable, as the select 
insn is a real one, whereas the PHI node only a potential insn.  Of course 
the same coalescing algorithms as in out-of-ssa can be used to make also 
the select a no-op.

With that you can generally express conditional code (with some 
limitations) as straight line code, which might enable some other 
interesting transformations.  Somewhen it has to be converted back to 
jumpy code for many machines, of course.  Depending on the machine perhaps 
even before going out-of-ssa so that some cleanups can still be done (e.g. 
merging statements under the same predicate into one basic block again, in 
case some intermediate transformations separated them from each other).


Ciao,
Michael.

      parent reply	other threads:[~2007-09-13  9:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-31 13:46 Tehila Meyzels
2007-07-31 15:01 ` Daniel Berlin
2007-07-31 15:06   ` Michael Matz
2007-08-06 12:16     ` Tehila Meyzels
2007-08-06 14:31       ` Michael Matz
2007-08-01 11:02   ` Tehila Meyzels
2007-08-01 15:27     ` Daniel Berlin
2007-08-01 18:52       ` Ayal Zaks
2007-08-01 19:59         ` Daniel Berlin
2007-09-12 21:48 ` trevor_smigiel
2007-09-13  9:24   ` Richard Guenther
2007-09-13  9:58   ` Michael Matz [this message]

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=Pine.LNX.4.64.0709131147310.23011@wotan.suse.de \
    --to=matz@suse.de \
    --cc=TEHILA@il.ibm.com \
    --cc=dorit@il.ibm.com \
    --cc=dpatel@il.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gcc@gcc.gnu.org \
    --cc=trevor_smigiel@playstation.sony.com \
    --cc=zaks@il.ibm.com \
    /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).