[llvm] [llvm-profgen] Filter out ambiguous cold profiles during profile generation (PR #81803)

via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 14 19:50:16 PST 2024


================
@@ -196,6 +196,33 @@ void ProfileGeneratorBase::showDensitySuggestion(double Density) {
            << "% total samples: " << format("%.1f", Density) << "\n";
 }
 
+bool ProfileGeneratorBase::filterAmbiguousProfile(FunctionSamples &FS) {
+  for (const auto &Prefix : FuncPrefixsToFilter) {
+    if (FS.getFuncName().starts_with(Prefix))
+      return true;
+  }
+
+  // Filter the function profiles for the inlinees.
+  for (auto &Callees :
+       const_cast<CallsiteSampleMap &>(FS.getCallsiteSamples())) {
+    auto &CalleesMap = Callees.second;
+    for (auto I = CalleesMap.begin(); I != CalleesMap.end();) {
+      auto Tmp = I++;
----------------
WenleiHe wrote:

nit: give it a better name than `Tmp`

https://github.com/llvm/llvm-project/pull/81803


More information about the llvm-commits mailing list