Enable --salvage-unused-profile for AutoFDO
Additionally enable --salvage-unused-profile, to allow the compiler to
identify and fix profile mismatches due to renamed functions.
This functionality was added to Clang in https://github.com/llvm/llvm-project/pull/95135.
Test: presubmit
Change-Id: I7f441e88409cb29eea746c281af2f7874df1688c
diff --git a/cc/afdo.go b/cc/afdo.go
index 1233e33..9be3918 100644
--- a/cc/afdo.go
+++ b/cc/afdo.go
@@ -108,6 +108,8 @@
// 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...)
+ // Salvage stale profile by fuzzy matching renamed functions.
+ flags.Local.CFlags = append([]string{"-mllvm", "--salvage-unused-profile=true"}, 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