From b6ec66a173d26be9bbd23d41133733539bce0f91 Mon Sep 17 00:00:00 2001 From: Yi Kong Date: Fri, 31 Jan 2020 12:36:12 +0800 Subject: [PATCH] Add -fprofile-sample-accurate flag for sampling PGO This flag indicates that the sample profile data matches the source and can be fully trusted. The compiler will make aggressive assumption that functions without any samples are cold functions, and will optimize for size for them. Test: binary size reduces to match instr PGO Bug: 79161490 Change-Id: I53d6d05be70c39e5eb28b2f5b0549d9eb6b5cc62 --- cc/pgo.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cc/pgo.go b/cc/pgo.go index 6c39d8347..8eb340053 100644 --- a/cc/pgo.go +++ b/cc/pgo.go @@ -43,7 +43,7 @@ var pgoProfileProjectsConfigKey = android.NewOnceKey("PgoProfileProjects") const profileInstrumentFlag = "-fprofile-generate=/data/local/tmp" const profileSamplingFlag = "-gmlt -fdebug-info-for-profiling" const profileUseInstrumentFormat = "-fprofile-use=%s" -const profileUseSamplingFormat = "-fprofile-sample-use=%s" +const profileUseSamplingFormat = "-fprofile-sample-accurate -fprofile-sample-use=%s" func getPgoProfileProjects(config android.DeviceConfig) []string { return config.OnceStringSlice(pgoProfileProjectsConfigKey, func() []string {