[llvm] [BOLT] Use symbol table info in registerFragment (PR #89648)

Maksim Panchenko via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 22 20:02:09 PDT 2024


================
@@ -1417,50 +1418,125 @@ void RewriteInstance::registerFragments() {
   if (!BC->HasSplitFunctions)
     return;
 
+  // Process fragments with ambiguous parents separately as they are typically a
+  // vanishing minority of cases and require expensive symbol table lookups.
+  std::vector<std::pair<StringRef, BinaryFunction *>> AmbiguousFragments;
   for (auto &BFI : BC->getBinaryFunctions()) {
     BinaryFunction &Function = BFI.second;
     if (!Function.isFragment())
       continue;
-    unsigned ParentsFound = 0;
     for (StringRef Name : Function.getNames()) {
       StringRef BaseName, Suffix;
       std::tie(BaseName, Suffix) = Name.split('/');
       const size_t ColdSuffixPos = BaseName.find(".cold");
----------------
maksfb wrote:

Let's use `NameResolver::restore()` here to get `BaseName`. We can do without `Suffix`.

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


More information about the llvm-commits mailing list