Enable --salvage-stale-profile for AutoFDO
This enables the compiler to salvage stale profile by fuzzy matching and
use the remapped location for sample profile query.
This functionality was added to Clang in https://reviews.llvm.org/D147456
Test: presubmit
Test: graphics performance test
Change-Id: I8a2e6e1ebed82e8d0fa8ec2bd2edd87e904fb311
diff --git a/cc/afdo.go b/cc/afdo.go
index 8d8341e..1233e33 100644
--- a/cc/afdo.go
+++ b/cc/afdo.go
@@ -105,6 +105,9 @@
// The flags are prepended to allow overriding.
profileUseFlag := fmt.Sprintf(afdoFlagsFormat, fdoProfilePath)
flags.Local.CFlags = append([]string{profileUseFlag}, flags.Local.CFlags...)
+ // Salvage stale profile by fuzzy matching and use the remapped location for sample profile query.
+ flags.Local.CFlags = append([]string{"-mllvm", "--salvage-stale-profile=true"}, flags.Local.CFlags...)
+ flags.Local.CFlags = append([]string{"-mllvm", "--salvage-stale-profile-max-callsites=2000"}, flags.Local.CFlags...)
flags.Local.LdFlags = append([]string{profileUseFlag, "-Wl,-mllvm,-no-warn-sample-unused=true"}, flags.Local.LdFlags...)
// Update CFlagsDeps and LdFlagsDeps so the module is rebuilt