Merge "Don't reduce inline limit for afdo enabled projects" am: 1ca54b2cfd

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

Change-Id: I3bd1821814d89267caddae48058230e62f71f25e
This commit is contained in:
Yi Kong
2022-02-14 20:50:02 +00:00
committed by Automerger Merge Worker
2 changed files with 13 additions and 1 deletions

View File

@@ -505,6 +505,7 @@ type ModuleContextIntf interface {
selectedStl() string selectedStl() string
baseModuleName() string baseModuleName() string
getVndkExtendsModuleName() string getVndkExtendsModuleName() string
isAfdoCompile() bool
isPgoCompile() bool isPgoCompile() bool
isNDKStubLibrary() bool isNDKStubLibrary() bool
useClangLld(actx ModuleContext) bool useClangLld(actx ModuleContext) bool
@@ -1259,6 +1260,13 @@ func (c *Module) IsVndk() bool {
return false return false
} }
func (c *Module) isAfdoCompile() bool {
if afdo := c.afdo; afdo != nil {
return afdo.Properties.AfdoTarget != nil
}
return false
}
func (c *Module) isPgoCompile() bool { func (c *Module) isPgoCompile() bool {
if pgo := c.pgo; pgo != nil { if pgo := c.pgo; pgo != nil {
return pgo.Properties.PgoCompile return pgo.Properties.PgoCompile
@@ -1536,6 +1544,10 @@ func (ctx *moduleContextImpl) isVndk() bool {
return ctx.mod.IsVndk() return ctx.mod.IsVndk()
} }
func (ctx *moduleContextImpl) isAfdoCompile() bool {
return ctx.mod.isAfdoCompile()
}
func (ctx *moduleContextImpl) isPgoCompile() bool { func (ctx *moduleContextImpl) isPgoCompile() bool {
return ctx.mod.isPgoCompile() return ctx.mod.isPgoCompile()
} }

View File

@@ -123,7 +123,7 @@ func (lto *lto) flags(ctx BaseModuleContext, flags Flags) Flags {
// If the module does not have a profile, be conservative and limit cross TU inline // If the module does not have a profile, be conservative and limit cross TU inline
// limit to 5 LLVM IR instructions, to balance binary size increase and performance. // limit to 5 LLVM IR instructions, to balance binary size increase and performance.
if !ctx.isPgoCompile() { if !ctx.isPgoCompile() && !ctx.isAfdoCompile() {
flags.Local.LdFlags = append(flags.Local.LdFlags, flags.Local.LdFlags = append(flags.Local.LdFlags,
"-Wl,-plugin-opt,-import-instr-limit=5") "-Wl,-plugin-opt,-import-instr-limit=5")
} }