[PATCH] D104346: [lld][MachO] Sort symbols in parallel

Xuanda Yang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 15 18:51:36 PDT 2021


TH3CHARLie created this revision.
TH3CHARLie added a reviewer: int3.
TH3CHARLie added projects: lld, lld-macho.
Herald added a reviewer: gkm.
Herald added a reviewer: lld-macho.
TH3CHARLie requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

source: https://bugs.llvm.org/show_bug.cgi?id=50689

Sort symbols in parallel using parallel_sort. 
Use address name to break ties if two symbols have the same address.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104346

Files:
  lld/MachO/MapFile.cpp


Index: lld/MachO/MapFile.cpp
===================================================================
--- lld/MachO/MapFile.cpp
+++ lld/MachO/MapFile.cpp
@@ -52,9 +52,11 @@
   // appear in the output file rather than the order they appeared in the input
   // files.
   for (auto &it : ret)
-    llvm::stable_sort(it.second, [](Defined *a, Defined *b) {
-      return a->getVA() < b->getVA();
-    });
+    llvm::parallel::detail::parallel_sort(
+        it.second.begin(), it.second.end(), [](Defined *a, Defined *b) {
+          return a->getVA() != b->getVA() ? a->getVA() < b->getVA()
+                                          : a->getName() < b->getName();
+        });
   return ret;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104346.352316.patch
Type: text/x-patch
Size: 691 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210616/e8292b7e/attachment.bin>


More information about the llvm-commits mailing list