public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Carlo Wood <carlo@alinoe.com>
To: Michel LESPINASSE <walken@zoy.org>
Cc: Andrew Haley <aph@redhat.com>, gcc@gcc.gnu.org
Subject: Re: issues with inlining
Date: Fri, 10 Jan 2003 00:15:00 -0000	[thread overview]
Message-ID: <20030109225546.GA27959@alinoe.com> (raw)
In-Reply-To: <20030109215002.GC31311@zoy.org>

On Thu, Jan 09, 2003 at 01:50:02PM -0800, Michel LESPINASSE wrote:
> > According to the docs
> > 
> >      `-O3' turns on all optimizations specified by `-O2' and also
> >      turns on the `inline-functions' option.

But that says nothing about priority regulation.

> > so why are you using -O3 if you want to control inlining by means of
> > the "inline" kwyword?

To let the compiler decide is MORE can be inlined than what I already
marked as must-be-inlined (although it doesn't do that :/).

> >>> 4) The instruction limit that can be set with -finline-limit
> >>>    seems to count instructions before optimization...
> >
> > True -- the inliner works at the source level before optimization is
> > performed.  This is the best way to do it.

Of course it is best to FIRST inline and THEN optimize - but, the set
instruction limit should be on the optimized result, not on on the
number of instructions before optimization.

> You're most probably right on average. But you sometimes see code that
> use compile-time constants for specialization, i.e. one big inline
> routine that evaluates to something small based on the value of some
> constant parameters. In this case, the fact the inliner only sees the
> huge initial routine instead of the smaller one after specialization,
> combined with the fact the programmer can not use the inline keyword
> to force inlining, is an issue.

Exactly my point.  I use HUGE template functions that go like:

  if (constant == 1)
  {
    ...
  }
  else if (constant == 2)
  {
    ...
  }
  
  etc etc.  We talk about a reduction of 100 in size ONLY because
  of if (CONSTANT) { } constructs.  The -finline-limit is really 
  un usable when it doesn't ignore the instructions in those
  blocks that will not be used.  Note that even with -O0 these
  blocks are removed... so why the need to count those instruction
  when deciding whether or not to inline the function?!

-- 
Carlo Wood <carlo@alinoe.com>

  reply	other threads:[~2003-01-09 22:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-18 18:32 Carlo Wood
2003-01-09 21:40 ` Michel LESPINASSE
2003-01-09 21:50   ` Andrew Haley
2003-01-09 22:52     ` Michel LESPINASSE
2003-01-10  0:15       ` Carlo Wood [this message]
2003-01-19 19:16         ` Alexandre Oliva
2003-01-19 20:49           ` 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=20030109225546.GA27959@alinoe.com \
    --to=carlo@alinoe.com \
    --cc=aph@redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=walken@zoy.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).