diff options
author | Yi Kong <yikong@google.com> | 2018-04-24 10:42:02 -0700 |
---|---|---|
committer | Yi Kong <yikong@google.com> | 2018-05-07 15:16:36 -0700 |
commit | ca610d2be459358a66815d88f20c751106af956c (patch) | |
tree | 744312fa737ffaf9511f7be8e7fdf143f112f916 | |
parent | 028f42f002ffb679e9e8816ce74bb15623203b0f (diff) | |
download | build_soong-ca610d2be459358a66815d88f20c751106af956c.tar.gz build_soong-ca610d2be459358a66815d88f20c751106af956c.tar.bz2 build_soong-ca610d2be459358a66815d88f20c751106af956c.zip |
Take Enable_profile_use into account when checking if PGO is enabled
Test: m
Change-Id: I3c589043af145450d0d97ef354a74845e9fae483
-rw-r--r-- | cc/pgo.go | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -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 } |