Enable MLGO inliner optimization for optimize_for_size cases
This helps reduce binary size for these projects by ~3%.
Test: presubmit
Bug: 342090838
Change-Id: Ie1e0586ddf5f40aa1e81fc2628a6499093de9699
diff --git a/cc/lto.go b/cc/lto.go
index a084db7..60eb4d6 100644
--- a/cc/lto.go
+++ b/cc/lto.go
@@ -144,7 +144,7 @@
if !ctx.Config().IsEnvFalse("THINLTO_USE_MLGO") {
// Register allocation MLGO flags for ARM64.
- if ctx.Arch().ArchType == android.Arm64 {
+ if ctx.Arch().ArchType == android.Arm64 && !ctx.optimizeForSize() {
ltoLdFlags = append(ltoLdFlags, "-Wl,-mllvm,-regalloc-enable-advisor=release")
}
// Flags for training MLGO model.