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

Bug: http://b/162702246

Test: m ANDROID_PGO_INSTRUMENT=hwui hwuimacro and check hwuimacro has
      PGO instrumentation.
Change-Id: I8044702e0aed4fa7bb9ac71608a83a95f319abd9
diff --git a/cc/pgo.go b/cc/pgo.go
index 674e1bb..6bf0ad0 100644
--- a/cc/pgo.go
+++ b/cc/pgo.go
@@ -290,17 +290,16 @@
 
 	// 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