mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: Rich Felker <dalias@libc.org>
Cc: musl@lists.openwall.com
Subject: Re: [musl] Dropping -Os
Date: Wed, 24 May 2023 00:20:54 +0200	[thread overview]
Message-ID: <20230523222054.GY3630668@port70.net> (raw)
In-Reply-To: <20230522164841.GS4163@brightrain.aerifal.cx>

* Rich Felker <dalias@libc.org> [2023-05-22 12:48:42 -0400]:
> It's been known for a long time now that -Os is bad, mainly because it
> imposes a few really ugly pessimizations without their own switches,
> like forcing use of div instructions for div-by-constant instead of
> allowing strength reduction to a mul (because the mul takes a couple
> more bytes of .text O_o).
> 
> The attached proposed change switches over to starting with -O2 and
> patching it up with the actually-desirable parts of -Os.
> 
> AIUI, at least with GCC this has other side effects, because the -O3
> used with OPTIMIZE_GLOBS (--enable-optimize for particular components)
> will not override explicit -f options. So there might be more work
> that should be done splitting out the size/speed CFLAGS into separate
> variables and only applying one to each file, rather than putting -O3
> on top like we do now. Or it might not matter.
> 
> It's also perhaps worth considering whether this breakdown still makes
> sense, or if there are unified options that would have low size cost
> but achieve the bulk of the benefit of -O3.

sounds good.

on aarch64 with gcc12 -Os vs -O2+-f* is 4% size increase and -Os
vs -O2 is 10% size increase (libc.so).

the 4% seems to be mostly inlining decisions (including inlining
small memset/memcpy).

the -f does change -O3 code gen, but i cant tell by just looking
at the asm how much that matters.

      reply	other threads:[~2023-05-23 22:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-22 16:48 Rich Felker
2023-05-23 22:20 ` Szabolcs Nagy [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=20230523222054.GY3630668@port70.net \
    --to=nsz@port70.net \
    --cc=dalias@libc.org \
    --cc=musl@lists.openwall.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).