diff options
author | Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> | 2024-03-22 09:01:23 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2024-03-22 09:01:23 +0000 |
commit | bfa7f261d11f232e87d3de7d5c12b75813573a4e (patch) | |
tree | 61104f8a7bf593de4cca2f89b07276cd7243bcd5 | |
parent | 8d98a99ad7c8a090ca10a3b83e5cbb21f0fa8c47 (diff) | |
parent | 55019c43f45b1ee0845e38b66d34b56515030fbf (diff) | |
download | soong-bfa7f261d11f232e87d3de7d5c12b75813573a4e.tar.gz |
Merge "Revert "Enable full LTO optimization by default"" into main
-rw-r--r-- | cc/lto.go | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -54,9 +54,6 @@ type LTOProperties struct { // Use -fwhole-program-vtables cflag. Whole_program_vtables *bool - - // Use --lto-O0 flag. - Lto_O0 *bool } type lto struct { @@ -113,8 +110,12 @@ func (lto *lto) flags(ctx ModuleContext, flags Flags) Flags { ltoCFlags := []string{"-flto=thin", "-fsplit-lto-unit"} var ltoLdFlags []string - // Do not perform costly LTO optimizations for Eng builds. - if Bool(lto.Properties.Lto_O0) || ctx.Config().Eng() { + // 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() { ltoLdFlags = append(ltoLdFlags, "-Wl,--lto-O0") } |