Merge "Provide an environment variable to disable mlgo" into main

This commit is contained in:
Aditya Kumar
2023-11-15 22:13:18 +00:00
committed by Gerrit Code Review

View File

@@ -147,10 +147,12 @@ func (lto *lto) flags(ctx BaseModuleContext, flags Flags) Flags {
}
}
// Register allocation MLGO flags for ARM64.
if ctx.Arch().ArchType == android.Arm64 {
ltoCFlags = append(ltoCFlags, "-mllvm -regalloc-enable-advisor=release")
ltoLdFlags = append(ltoLdFlags, "-Wl,-mllvm,-regalloc-enable-advisor=release")
if !ctx.Config().IsEnvFalse("THINLTO_USE_MLGO") {
// Register allocation MLGO flags for ARM64.
if ctx.Arch().ArchType == android.Arm64 {
ltoCFlags = append(ltoCFlags, "-mllvm -regalloc-enable-advisor=release")
ltoLdFlags = append(ltoLdFlags, "-Wl,-mllvm,-regalloc-enable-advisor=release")
}
// Flags for training MLGO model.
if ctx.Config().IsEnvTrue("THINLTO_EMIT_INDEXES_AND_IMPORTS") {
ltoLdFlags = append(ltoLdFlags, "-Wl,--save-temps=import")