[pgo] Allow profile gather and use flags to coexist for sampling PGO

Bug: 79161490
Test: presubmit
Change-Id: I90df9c04dbe2a423c06e9a966fe9bcaed0a84a65
This commit is contained in:
Yi Kong
2020-07-22 01:41:58 +08:00
parent 84803c50a6
commit a575ff38a8

View File

@@ -290,15 +290,17 @@ func (pgo *pgo) flags(ctx ModuleContext, flags Flags) Flags {
// Add flags to profile this module based on its profile_kind
if props.ShouldProfileModule && props.isInstrumentation() {
return props.addInstrumentationProfileGatherFlags(ctx, flags)
props.addInstrumentationProfileGatherFlags(ctx, flags)
// Instrumentation PGO use and gather flags cannot coexist.
return flags
} else if props.ShouldProfileModule && props.isSampling() {
return props.addSamplingProfileGatherFlags(ctx, flags)
props.addSamplingProfileGatherFlags(ctx, flags)
} else if ctx.DeviceConfig().SamplingPGO() {
return props.addSamplingProfileGatherFlags(ctx, flags)
props.addSamplingProfileGatherFlags(ctx, flags)
}
if !ctx.Config().IsEnvTrue("ANDROID_PGO_NO_PROFILE_USE") {
return props.addProfileUseFlags(ctx, flags)
props.addProfileUseFlags(ctx, flags)
}
return flags