Loading cc/cc.go +12 −0 Original line number Diff line number Diff line Loading @@ -211,6 +211,7 @@ type ModuleContextIntf interface { selectedStl() string baseModuleName() string getVndkExtendsModuleName() string isPgoCompile() bool } type ModuleContext interface { Loading Loading @@ -408,6 +409,13 @@ func (c *Module) isVndk() bool { return false } func (c *Module) isPgoCompile() bool { if pgo := c.pgo; pgo != nil { return pgo.Properties.PgoCompile } return false } func (c *Module) isVndkSp() bool { if vndkdep := c.vndkdep; vndkdep != nil { return vndkdep.isVndkSp() Loading Loading @@ -507,6 +515,10 @@ func (ctx *moduleContextImpl) isVndk() bool { return ctx.mod.isVndk() } func (ctx *moduleContextImpl) isPgoCompile() bool { return ctx.mod.isPgoCompile() } func (ctx *moduleContextImpl) isVndkSp() bool { return ctx.mod.isVndkSp() } Loading cc/lto.go +7 −0 Original line number Diff line number Diff line Loading @@ -87,6 +87,13 @@ func (lto *lto) flags(ctx BaseModuleContext, flags Flags) Flags { flags.LdFlags = append(flags.LdFlags, "-Wl,-plugin-opt,-emulated-tls") } flags.ArGoldPlugin = true // If the module does not have a profile, be conservative and do not inline // or unroll loops during LTO, in order to prevent significant size bloat. if !ctx.isPgoCompile() { flags.LdFlags = append(flags.LdFlags, "-Wl,-plugin-opt,-inline-threshold=0") flags.LdFlags = append(flags.LdFlags, "-Wl,-plugin-opt,-unroll-threshold=0") } } return flags } Loading cc/pgo.go +9 −2 Original line number Diff line number Diff line Loading @@ -45,7 +45,7 @@ func getPgoProfileProjects(config android.DeviceConfig) []string { }) } func recordMissingProfileFile(ctx ModuleContext, missing string) { func recordMissingProfileFile(ctx BaseModuleContext, missing string) { getNamedMapForConfig(ctx.Config(), modulesMissingProfileFile).Store(missing, true) } Loading @@ -63,6 +63,7 @@ type PgoProperties struct { PgoPresent bool `blueprint:"mutated"` ShouldProfileModule bool `blueprint:"mutated"` PgoCompile bool `blueprint:"mutated"` } type pgo struct { Loading Loading @@ -98,7 +99,7 @@ func (props *PgoProperties) addProfileGatherFlags(ctx ModuleContext, flags Flags return flags } func (props *PgoProperties) getPgoProfileFile(ctx ModuleContext) android.OptionalPath { func (props *PgoProperties) getPgoProfileFile(ctx BaseModuleContext) android.OptionalPath { // Test if the profile_file is present in any of the PGO profile projects for _, profileProject := range getPgoProfileProjects(ctx.DeviceConfig()) { path := android.ExistentPathForSource(ctx, "", profileProject, *props.Pgo.Profile_file) Loading Loading @@ -232,6 +233,12 @@ func (pgo *pgo) begin(ctx BaseModuleContext) { } } } if !ctx.Config().IsEnvTrue("ANDROID_PGO_NO_PROFILE_USE") { if profileFile := pgo.Properties.getPgoProfileFile(ctx); profileFile.Valid() { pgo.Properties.PgoCompile = true } } } func (pgo *pgo) deps(ctx BaseModuleContext, deps Deps) Deps { Loading Loading
cc/cc.go +12 −0 Original line number Diff line number Diff line Loading @@ -211,6 +211,7 @@ type ModuleContextIntf interface { selectedStl() string baseModuleName() string getVndkExtendsModuleName() string isPgoCompile() bool } type ModuleContext interface { Loading Loading @@ -408,6 +409,13 @@ func (c *Module) isVndk() bool { return false } func (c *Module) isPgoCompile() bool { if pgo := c.pgo; pgo != nil { return pgo.Properties.PgoCompile } return false } func (c *Module) isVndkSp() bool { if vndkdep := c.vndkdep; vndkdep != nil { return vndkdep.isVndkSp() Loading Loading @@ -507,6 +515,10 @@ func (ctx *moduleContextImpl) isVndk() bool { return ctx.mod.isVndk() } func (ctx *moduleContextImpl) isPgoCompile() bool { return ctx.mod.isPgoCompile() } func (ctx *moduleContextImpl) isVndkSp() bool { return ctx.mod.isVndkSp() } Loading
cc/lto.go +7 −0 Original line number Diff line number Diff line Loading @@ -87,6 +87,13 @@ func (lto *lto) flags(ctx BaseModuleContext, flags Flags) Flags { flags.LdFlags = append(flags.LdFlags, "-Wl,-plugin-opt,-emulated-tls") } flags.ArGoldPlugin = true // If the module does not have a profile, be conservative and do not inline // or unroll loops during LTO, in order to prevent significant size bloat. if !ctx.isPgoCompile() { flags.LdFlags = append(flags.LdFlags, "-Wl,-plugin-opt,-inline-threshold=0") flags.LdFlags = append(flags.LdFlags, "-Wl,-plugin-opt,-unroll-threshold=0") } } return flags } Loading
cc/pgo.go +9 −2 Original line number Diff line number Diff line Loading @@ -45,7 +45,7 @@ func getPgoProfileProjects(config android.DeviceConfig) []string { }) } func recordMissingProfileFile(ctx ModuleContext, missing string) { func recordMissingProfileFile(ctx BaseModuleContext, missing string) { getNamedMapForConfig(ctx.Config(), modulesMissingProfileFile).Store(missing, true) } Loading @@ -63,6 +63,7 @@ type PgoProperties struct { PgoPresent bool `blueprint:"mutated"` ShouldProfileModule bool `blueprint:"mutated"` PgoCompile bool `blueprint:"mutated"` } type pgo struct { Loading Loading @@ -98,7 +99,7 @@ func (props *PgoProperties) addProfileGatherFlags(ctx ModuleContext, flags Flags return flags } func (props *PgoProperties) getPgoProfileFile(ctx ModuleContext) android.OptionalPath { func (props *PgoProperties) getPgoProfileFile(ctx BaseModuleContext) android.OptionalPath { // Test if the profile_file is present in any of the PGO profile projects for _, profileProject := range getPgoProfileProjects(ctx.DeviceConfig()) { path := android.ExistentPathForSource(ctx, "", profileProject, *props.Pgo.Profile_file) Loading Loading @@ -232,6 +233,12 @@ func (pgo *pgo) begin(ctx BaseModuleContext) { } } } if !ctx.Config().IsEnvTrue("ANDROID_PGO_NO_PROFILE_USE") { if profileFile := pgo.Properties.getPgoProfileFile(ctx); profileFile.Valid() { pgo.Properties.PgoCompile = true } } } func (pgo *pgo) deps(ctx BaseModuleContext, deps Deps) Deps { Loading