diff options
author | Yi Kong <yikong@google.com> | 2024-03-22 02:15:46 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2024-03-22 02:15:46 +0000 |
commit | 2703b42ccb6242b6ab9f1616ec443b8915688629 (patch) | |
tree | 8365ac299dc56de1438e3edc019e99db87b41c38 | |
parent | d3348dbaaa374ab69bedc081a64209e1c0bb886c (diff) | |
parent | ce23b9ba161c807737e72e04d3914e22f68a4268 (diff) | |
download | soong-2703b42ccb6242b6ab9f1616ec443b8915688629.tar.gz |
Merge "Enable full LTO optimization by default" into main
-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") } |