public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Lassi A. Tuura" <Lassi.Tuura@cern.ch>
To: Jeffrey A Law <law@cygnus.com>
Cc: Richard Henderson <rth@cygnus.com>, Joe Buck <jbuck@synopsys.com>,
	egcs@cygnus.com
Subject: Re: switch index optimization
Date: Tue, 27 Jan 1998 07:35:00 -0000	[thread overview]
Message-ID: <Pine.HPP.3.95a.980127162532.25774B-100000@hpatl20.cern.ch> (raw)
In-Reply-To: <11917.885799772@hurl.cygnus.com>

On Mon, 26 Jan 1998, Jeffrey A Law wrote:
>   > 	if (x < 7) { if (x == 9) { } }
> Yup.  However, it's become pretty clear to me that the direction I
> was heading needs some serious work -- like full blown range checking
> code as found in fold_const.c, except on RTL instead of trees (yuk).
> 
> It's also not clear how useful that would be in practice; my hacked
> up version of cse.c only caught a small number of cases where it could
> improve real code instead of contrived example code.

I would think this kind of an optimisation would pay off for C++ code
where there are multitudes of small inlined methods.  The reason is that
the methods cannot always tell what state the object is in and hence
the body must be guarded with checks like this:

  if (! m_data) {
     // initialise `m_data' to something
  }
  // real code here

As the methods get inlined, these checks can repeat several times even if
it may be possible to prove that none of them (or only the first one)
needs to be evaluated.  This may, again, result in significant dead code
elimination and opportunities for further optimisation. 

It may well be that in C this optimisation does not produce any
significant benefits because of the way code gets written: small inlines
just aren't used all that much. 

Cheers,
//lat
--
Lassi.Tuura@cern.ch          There's no sunrise without a night


  reply	other threads:[~1998-01-27  7:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-01-25 22:34 Richard Henderson
1998-01-25 23:02 ` Joe Buck
1998-01-25 23:14   ` Richard Henderson
1998-01-25 23:27     ` Jeffrey A Law
1998-01-27  7:35       ` Lassi A. Tuura [this message]
1998-01-27  9:36         ` Jeffrey A Law
1998-01-27 13:09         ` Andi Kleen
1998-01-27  9:59           ` Jeffrey A Law
1998-01-27 10:20             ` Joe Buck
1998-01-27 13:09               ` Jeffrey A Law
     [not found] <egcs.199801271819.KAA01586@atrus.synopsys.com>
1998-01-28  1:10 ` Todd P. Whitesel

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.HPP.3.95a.980127162532.25774B-100000@hpatl20.cern.ch \
    --to=lassi.tuura@cern.ch \
    --cc=egcs@cygnus.com \
    --cc=jbuck@synopsys.com \
    --cc=law@cygnus.com \
    --cc=rth@cygnus.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).