Merge "Revert "Revert "[pgo] Return updated Flags after adding flags for PGO/AFDO"""

This commit is contained in:
Yi Kong 2020-09-03 07:25:24 +00:00 committed by Gerrit Code Review
commit 4f78c512d4

View file

@ -290,17 +290,16 @@ 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() {
props.addInstrumentationProfileGatherFlags(ctx, flags)
// Instrumentation PGO use and gather flags cannot coexist.
return flags
return props.addInstrumentationProfileGatherFlags(ctx, flags)
} else if props.ShouldProfileModule && props.isSampling() {
props.addSamplingProfileGatherFlags(ctx, flags)
flags = props.addSamplingProfileGatherFlags(ctx, flags)
} else if ctx.DeviceConfig().SamplingPGO() {
props.addSamplingProfileGatherFlags(ctx, flags)
flags = props.addSamplingProfileGatherFlags(ctx, flags)
}
if !ctx.Config().IsEnvTrue("ANDROID_PGO_NO_PROFILE_USE") {
props.addProfileUseFlags(ctx, flags)
flags = props.addProfileUseFlags(ctx, flags)
}
return flags