Respect THINLTO_USE_MLGO for ML inliner
Test: m statsd with toolchain that doesn't support MLGO
Change-Id: Ibbe2de7ac41a17288d666111a49de34d437d7ead
diff --git a/cc/compiler.go b/cc/compiler.go
index 022b712..7bba962 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -695,7 +695,9 @@
if ctx.optimizeForSize() {
flags.Local.CFlags = append(flags.Local.CFlags, "-Oz")
- flags.Local.LdFlags = append(flags.Local.LdFlags, "-Wl,-mllvm,-enable-ml-inliner=release")
+ if !ctx.Config().IsEnvFalse("THINLTO_USE_MLGO") {
+ flags.Local.LdFlags = append(flags.Local.LdFlags, "-Wl,-mllvm,-enable-ml-inliner=release")
+ }
}
// Exclude directories from manual binder interface allowed list.