[llvm-branch-commits] [llvm] [BOLT] Match functions with name similarity (PR #95884)

Amir Ayupov via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jul 3 09:31:25 PDT 2024


================
@@ -342,6 +350,107 @@ bool YAMLProfileReader::mayHaveProfileData(const BinaryFunction &BF) {
   return false;
 }
 
+uint64_t YAMLProfileReader::matchWithNameSimilarity(BinaryContext &BC) {
+  uint64_t MatchedWithNameSimilarity = 0;
+  ItaniumPartialDemangler Demangler;
+
+  // Demangle and derive namespace from function name.
+  auto DemangleName = [&](std::string &FunctionName) {
+    StringRef RestoredName = NameResolver::restore(FunctionName);
+    return demangle(RestoredName);
+  };
+  auto DeriveNameSpace = [&](std::string &DemangledName) {
+    if (Demangler.partialDemangle(DemangledName.c_str()))
+      return std::string("");
+    std::vector<char> Buffer(DemangledName.begin(), DemangledName.end());
+    size_t BufferSize = Buffer.size();
----------------
aaupov wrote:

```suggestion
    size_t BufferSize;
```

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


More information about the llvm-branch-commits mailing list