[Bug lto/97637] Compiling with LTO causes a bigger binary
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97637 Richard Biener changed: What|Removed |Added Ever confirmed|0 |1 Status|UNCONFIRMED |WAITING Last reconfirmed||2020-10-30 --- Comment #1 from Richard Biener --- You can try lowering the inliner budget via --param inline-unit-growth which defaults to 40 (a 40% increase due to inlining). Likely only LTO exposes inlining opportunities and -O2 is not -Os. (just guessing you use -O2) The absolute number is also uninteresting - what's the relative change?
[Bug lto/97637] Compiling with LTO causes a bigger binary
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97637 --- Comment #2 from Christer Solskogen --- You are correct. I've replaced Ofast with O2 (but it doesn't seem to matter that much) - with the default inline-unit-growth the binary gets 5% bigger. With inline-unit-growth=20 the binary gets 5%~ smaller. So that helped!
[Bug lto/97637] Compiling with LTO causes a bigger binary
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97637 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #3 from Jakub Jelinek --- Note, the main objectives of -O2 as well as -Ofast are code speed, code size is only secondary (because making code much larger might make it also slower). If you care primarily about code size, you should be using -Os.
[Bug lto/97637] Compiling with LTO causes a bigger binary
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97637 --- Comment #4 from Christer Solskogen --- Okay, so LTO together with O2/O3 or Ofast will not help code size that much. I was worried that something was wrong with how GCC was configured or the command line parameters I was using since the binary increased in size.
[Bug lto/97637] Compiling with LTO causes a bigger binary
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97637 --- Comment #5 from Jakub Jelinek --- Sometimes it may shrink the code a lot, it really depends on the code. Just that the question whether a particular transformation will make code faster or not is the primary question to ask, unless compiling with -Os or unless a particular code is e.g. through PGO determined to be cold.
[Bug lto/97637] Compiling with LTO causes a bigger binary
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97637 Christer Solskogen changed: What|Removed |Added Resolution|--- |INVALID Status|WAITING |RESOLVED