public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Dave Hudson <gcc@blueteddy.net>
To: Steven Bosscher <stevenb.gcc@gmail.com>
Cc: Ian Bolton <bolton@icerasemi.com>,  gcc@gcc.gnu.org
Subject: Re: BB reorder forced off for -Os
Date: Wed, 24 Mar 2010 18:37:00 -0000	[thread overview]
Message-ID: <AE7B8F6D-44B7-45C5-877E-B28D16A45356@blueteddy.net> (raw)
In-Reply-To: <571f6b511003231530k577613d6j333e1259b1198992@mail.gmail.com>

On 23 Mar 2010, at 22:30, Steven Bosscher wrote:

> On Tue, Mar 23, 2010 at 7:05 PM, Ian Bolton <bolton@icerasemi.com> wrote:
>> Is there any reason why BB reorder has been disabled
>> in bb-reorder.c for -Os, such that you can't even
>> turn it on with -freorder-blocks?
> 
> No, you should have the option to turn it on if you wish to do so. If
> that is not possible, I consider this a bug. If you open a PR and
> assign it to me, I'll look into it.

We're not able to enable BB reordering with -Os.  The behaviour is hard-coded via this if statement in rest_of_handle_reorder_blocks():

  if ((flag_reorder_blocks || flag_reorder_blocks_and_partition)
      /* Don't reorder blocks when optimizing for size because extra jump insns may
	 be created; also barrier may create extra padding.

	 More correctly we should have a block reordering mode that tried to
	 minimize the combined size of all the jumps.  This would more or less
	 automatically remove extra jumps, but would also try to use more short
	 jumps instead of long jumps.  */
      && optimize_function_for_speed_p (cfun))
    {
      reorder_basic_blocks ();

If you comment out the "&& optimize_function_for_speed_p (cfun)" then BB reordering takes places as desired (although this isn't a solution obviously).

In a private message Ian indicated that this had a small impact for the ISA he's working with but a significant performance gain.  I tried the same thing with the ISA I work on (Ubicom32) and this change typically increased code sizes by between 0.1% and 0.3% but improved performance by anything from 0.8% to 3% so on balance this is definitely winning for most of our users (this for a couple of benchmarks, the Linux kernel, busybox and smbd).


Regards,
Dave

  reply	other threads:[~2010-03-24 18:33 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-19 16:12 Understanding Scheduling Ian Bolton
2010-03-19 16:34 ` Alexander Monakov
2010-03-19 16:43   ` Ian Bolton
2010-03-19 16:41 ` Vladimir N. Makarov
2010-03-19 17:02   ` Ian Bolton
2010-03-19 17:13     ` Vladimir N. Makarov
2010-03-19 20:58     ` Jeff Law
2010-03-19 16:48 ` Steven Bosscher
2010-03-22 17:49   ` Ian Bolton
2010-03-23 12:55     ` Dave Hudson
2010-03-23 18:24       ` BB reorder forced off for -Os Ian Bolton
2010-03-23 20:01         ` Paul Koning
2010-03-23 21:10           ` Joe Buck
2010-03-23 22:55         ` Steven Bosscher
2010-03-24 18:37           ` Dave Hudson [this message]
2010-03-30 13:06             ` Ian Bolton
2010-04-08 17:55               ` Making BB Reorder Smarter " Ian Bolton

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=AE7B8F6D-44B7-45C5-877E-B28D16A45356@blueteddy.net \
    --to=gcc@blueteddy.net \
    --cc=bolton@icerasemi.com \
    --cc=gcc@gcc.gnu.org \
    --cc=stevenb.gcc@gmail.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).