Merge "Do not perform AFDO or optimizing LTO for eng builds" into main am: e2b87d7401 am: f4e59d2f48

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2856020

Change-Id: Ibcd2faf9eb49768529a50c4c60a5b3a0095d6122
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Yi Kong 2023-12-05 04:26:35 +00:00 committed by Automerger Merge Worker
commit e5994ccae1
3 changed files with 12 additions and 1 deletions

View file

@ -64,6 +64,13 @@ func (afdo *afdo) props() []interface{} {
return []interface{}{&afdo.Properties}
}
func (afdo *afdo) begin(ctx BaseModuleContext) {
// Disable on eng builds for faster build.
if ctx.Config().Eng() {
afdo.Properties.Afdo = false
}
}
// afdoEnabled returns true for binaries and shared libraries
// that set afdo prop to True and there is a profile available
func (afdo *afdo) afdoEnabled() bool {

View file

@ -2401,6 +2401,9 @@ func (c *Module) begin(ctx BaseModuleContext) {
if c.coverage != nil {
c.coverage.begin(ctx)
}
if c.afdo != nil {
c.afdo.begin(ctx)
}
if c.lto != nil {
c.lto.begin(ctx)
}

View file

@ -116,7 +116,8 @@ func (lto *lto) flags(ctx BaseModuleContext, flags Flags) Flags {
// better dead code elimination and CFG simplification, but do
// not perform costly optimizations for a balance between compile
// time, binary size and performance.
if !lto.ThinLTO() {
// Apply the same for Eng builds as well.
if !lto.ThinLTO() || ctx.Config().Eng() {
ltoLdFlags = append(ltoLdFlags, "-Wl,--lto-O0")
}