Merge "Take Enable_profile_use into account when checking if PGO is enabled"

This commit is contained in:
Yi Kong 2018-05-08 19:37:29 +00:00 committed by Gerrit Code Review
commit ea144bf779

View file

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