[llvm] [SampleFDO] Stale profile call-graph matching (PR #95135)

David Li via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 15 09:49:03 PDT 2024


================
@@ -590,14 +688,237 @@ void SampleProfileMatcher::computeAndReportProfileStaleness() {
   }
 }
 
+void SampleProfileMatcher::findNewIRFunctions() {
+  // TODO: Support MD5 profile.
+  if (FunctionSamples::UseMD5)
+    return;
+  StringSet<> NamesInProfile;
+  if (auto NameTable = Reader.getNameTable()) {
+    for (auto Name : *NameTable)
+      NamesInProfile.insert(Name.stringRef());
+  }
+
+  for (auto &F : M) {
+    // Skip declarations, as even if the function can be matched, we have
+    // nothing to do with it.
+    if (F.isDeclaration())
+      continue;
+
+    StringRef CanonFName = FunctionSamples::getCanonicalFnName(F.getName());
+    const auto *FS = getFlattenedSamplesFor(F);
+    if (FS)
+      continue;
+
+    // For extended binary, functions are fully inlined may not be loaded in the
----------------
david-xl wrote:

remove 'are'

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


More information about the llvm-commits mailing list