Bug 54078 - Bytemark 46% bigger binary with -flto
Summary: Bytemark 46% bigger binary with -flto
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: lto (show other bugs)
Version: 4.7.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: missed-optimization
Depends on:
Blocks:
 
Reported: 2012-07-24 09:52 UTC by wbrana
Modified: 2016-09-22 00:57 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description wbrana 2012-07-24 09:52:13 UTC
without -flto 106856 bytes
with -flto 156312 bytes

http://www.tux.org/~mayer/linux/nbench-byte-2.2.3.tar.gz

CFLAGS = -s -Wall -O3 -g0 -march=core2 -fomit-frame-pointer -funroll-loops -ffast-math -mssse3 -fno-PIE -fno-exceptions -fno-stack-protector
Comment 1 Richard Biener 2012-07-24 13:22:43 UTC
When using the linker-plugin?  That is, with -fwhole-program?
Comment 2 wbrana 2012-07-24 13:38:03 UTC
156312 bytes with
 -s -Wall -O3 -g0 -march=core2 -fomit-frame-pointer -funroll-loops
-ffast-math -mssse3 -fno-PIE -fno-exceptions -fno-stack-protector -flto -fwhole-program?
Comment 3 Marc Glisse 2012-07-28 06:47:49 UTC
(In reply to comment #0)
> without -flto 106856 bytes
> with -flto 156312 bytes

But is it faster?
Comment 4 wbrana 2012-07-28 06:54:06 UTC
one of tests is faster
Comment 5 wbrana 2013-04-13 16:43:10 UTC
branch 4.9

without lto 
101462 bytes

with -flto -fwhole-program
157243 bytes - linker bfd
155488 bytes - linker gold

other CFLAGS = -O3 -g0 -march=corei7 -fomit-frame-pointer -funroll-loops -ffast-math -fno-PIE -fno-exceptions -fno-stack-protector
Comment 6 wbrana 2013-04-13 17:01:27 UTC
executable is smaller with lto when I add -fno-inline-functions 
95928 vs 93880
Comment 7 wbrana 2013-04-13 17:34:23 UTC
-fno-inline-functions makes same tests 12% or 6% slower with lto/gold

NUMERIC SORT        :          1689.2  :      43.32  :      14.23
NUMERIC SORT        :          1483.2  :      38.04  :      12.49

IDEA                :            9932  :     151.91  :      45.10
IDEA                :            9360  :     143.16  :      42.50
Comment 8 wbrana 2013-04-13 17:59:47 UTC
lto/gold

-finline-limit=43
99960 bytes
NUMERIC SORT        :          1471.2  :      37.73  :      12.39

-finline-limit=44
149136 bytes
NUMERIC SORT        :          1705.2  :      43.73  :      14.36
Comment 9 Richard Biener 2013-04-15 10:22:59 UTC
Btw, with -O3 you essentially say you do not care for program size (IPA
cloning decisions blow up the unit without limits I think - unlike inlining
which is limited by unit-growth for large units).
Comment 10 wbrana 2014-08-12 17:50:25 UTC
there is difference also with O2 and branch 4.9

size in bytes
57199 -O2
55222 -O2 -flto
60681 -O2 -finline-functions
75301 -O2 -flto -finline-functions
67083 -O2 -flto -finline-functions --param large-unit-insns=1000