From ca610d2be459358a66815d88f20c751106af956c Mon Sep 17 00:00:00 2001 From: Yi Kong Date: Tue, 24 Apr 2018 10:42:02 -0700 Subject: [PATCH] Take Enable_profile_use into account when checking if PGO is enabled Test: m Change-Id: I3c589043af145450d0d97ef354a74845e9fae483 --- cc/pgo.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/cc/pgo.go b/cc/pgo.go index d39e4290d..a341ab9f9 100644 --- a/cc/pgo.go +++ b/cc/pgo.go @@ -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 }