Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230523222054.GY3630668@port70.net>
Date: Wed, 24 May 2023 00:20:54 +0200
From: Szabolcs Nagy <nsz@...t70.net>
To: Rich Felker <dalias@...c.org>
Cc: musl@...ts.openwall.com
Subject: Re: Dropping -Os

* Rich Felker <dalias@...c.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.

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.