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

Amir Ayupov via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 23 06:03:11 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");
----------------
aaupov wrote:

Oh right, I used a similar check just recently in an [alternative implementation](https://github.com/llvm/llvm-project/pull/89320/files#diff-4be6195ccdb53447f870b9b26a36d0b916ace3cbd6efe595bb3cbffd53cf0dacR1441).

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


More information about the llvm-commits mailing list