[llvm-branch-commits] [llvm] [BOLT] Name similarity function matching (PR #95884)

Amir Ayupov via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jun 25 12:32:18 PDT 2024


================
@@ -415,11 +422,87 @@ Error YAMLProfileReader::readProfile(BinaryContext &BC) {
     if (!YamlBF.Used && BF && !ProfiledFunctions.count(BF))
       matchProfileToFunction(YamlBF, *BF);
 
+  // Uses name similarity to match functions that were not matched by name.
+  uint64_t MatchedWithNameSimilarity = 0;
+
+  if (opts::NameSimilarityFunctionMatchingThreshold > 0) {
+    auto DemangleName = [&](std::string &FunctionName) {
+      StringRef RestoredName = NameResolver::restore(FunctionName);
+      return demangle(RestoredName);
+    };
+
+    auto DeriveNameSpace = [&](ItaniumPartialDemangler &ItaniumPartialDemangler,
----------------
aaupov wrote:

You can have ItaniumPartialDemangler defined above, and it will be captured by DeriveNameSpace lambda, so no need to pass it explicitly.

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


More information about the llvm-branch-commits mailing list