Take Enable_profile_use into account when checking if PGO is enabled

Test: m
Change-Id: I3c589043af145450d0d97ef354a74845e9fae483
This commit is contained in:
Yi Kong 2018-04-24 10:42:02 -07:00
parent 028f42f002
commit ca610d2be4

View file

@ -19,6 +19,8 @@ import (
"path/filepath"
"strings"
"github.com/google/blueprint/proptools"
"android/soong/android"
"android/soong/cc/config"
)
@ -160,13 +162,8 @@ func (props *PgoProperties) addProfileUseFlags(ctx ModuleContext, flags Flags) F
return flags
}
// Skip -fprofile-use if 'enable_profile_use' property is set
if props.Pgo.Enable_profile_use != nil && *props.Pgo.Enable_profile_use == false {
return flags
}
// If the profile file is found, add flags to use the profile
if profileFile := props.getPgoProfileFile(ctx); profileFile.Valid() {
if props.PgoCompile {
profileFile := props.getPgoProfileFile(ctx)
profileFilePath := profileFile.Path()
profileUseFlags := props.profileUseFlags(ctx, profileFilePath.String())
@ -257,7 +254,8 @@ func (pgo *pgo) begin(ctx BaseModuleContext) {
}
}
if !ctx.Config().IsEnvTrue("ANDROID_PGO_NO_PROFILE_USE") {
if !ctx.Config().IsEnvTrue("ANDROID_PGO_NO_PROFILE_USE") &&
proptools.BoolDefault(pgo.Properties.Pgo.Enable_profile_use, true) {
if profileFile := pgo.Properties.getPgoProfileFile(ctx); profileFile.Valid() {
pgo.Properties.PgoCompile = true
}