Merge changes from topic "optimize_for_size" into main

* changes:
  Enable MLGO inliner optimization for optimize_for_size cases
  Add "Optimize_for_size" build property
This commit is contained in:
Yi Kong
2024-06-11 05:38:13 +00:00
committed by Gerrit Code Review
3 changed files with 21 additions and 1 deletions

View File

@@ -693,6 +693,11 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
flags.Local.CFlags = append(flags.Local.CFlags, "-fopenmp")
}
if ctx.optimizeForSize() {
flags.Local.CFlags = append(flags.Local.CFlags, "-Oz")
flags.Local.LdFlags = append(flags.Local.LdFlags, "-Wl,-mllvm,-enable-ml-inliner=release")
}
// Exclude directories from manual binder interface allowed list.
//TODO(b/145621474): Move this check into IInterface.h when clang-tidy no longer uses absolute paths.
if android.HasAnyPrefix(ctx.ModuleDir(), allowedManualInterfacePaths) {