diff options
author | Yi Kong <yikong@google.com> | 2024-03-22 11:30:46 +0000 |
---|---|---|
committer | Yi Kong <yikong@google.com> | 2024-03-27 01:57:22 +0000 |
commit | 7549990a957c66d1ed29bde27da05be001491f9f (patch) | |
tree | 8835d1c014b1db0116a84d9bd578cae547a29166 | |
parent | 55019c43f45b1ee0845e38b66d34b56515030fbf (diff) | |
download | soong-7549990a957c66d1ed29bde27da05be001491f9f.tar.gz |
Revert^2 "Enable full LTO optimization by default"
55019c43f45b1ee0845e38b66d34b56515030fbf
We set the default optimization mode to --lto-O0 for LTO enabled
projects, in order to save build time. This is missing some performance
optimizations, esp. related to vectorization. Now that we suggest eng
build for developers, we can enable full optimization by default.
When we introduced --lto-O0, we achieved a 4.2% saving in
system-processes-memory-direct. Enabling full LTO optimization will
trade some of the memory / binary size savings for better code
performance. For system-processes-memory-direct, it is 2.0% increase
compared to --lto-O0, or a net 2.2% saving compared to baseline.
Change-Id: I747939ac4d6e4a66e3ef776f4c36eebc7bf34c86
-rw-r--r-- | cc/lto.go | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -54,6 +54,9 @@ type LTOProperties struct { // Use -fwhole-program-vtables cflag. Whole_program_vtables *bool + + // Use --lto-O0 flag. + Lto_O0 *bool } type lto struct { @@ -110,12 +113,8 @@ func (lto *lto) flags(ctx ModuleContext, flags Flags) Flags { ltoCFlags := []string{"-flto=thin", "-fsplit-lto-unit"} var ltoLdFlags []string - // The module did not explicitly turn on LTO. Only leverage LTO's - // better dead code elimination and CFG simplification, but do - // not perform costly optimizations for a balance between compile - // time, binary size and performance. - // Apply the same for Eng builds as well. - if !lto.ThinLTO() || ctx.Config().Eng() { + // Do not perform costly LTO optimizations for Eng builds. + if Bool(lto.Properties.Lto_O0) || ctx.Config().Eng() { ltoLdFlags = append(ltoLdFlags, "-Wl,--lto-O0") } |