[PATCH] D92734: [lld/mac] Make X86_64::getImplicitAddend not do heap allocations

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 6 10:52:31 PST 2020


thakis created this revision.
thakis added a reviewer: lld-macho.
thakis requested review of this revision.

Speeds up linking Chromium's base_unittests almost 10%. According to ministat:

      N           Min           Max        Median           Avg        Stddev
  x   5    0.72193289    0.73073196    0.72560811    0.72565799  0.0032265649
  +   5    0.64069581    0.67173195    0.65876389    0.65796089   0.011349451
  Difference at 95.0% confidence
  	-0.0676971 +/- 0.0121682
  	-9.32906% +/- 1.67685%
  	(Student's t, pooled s = 0.00834328)


https://reviews.llvm.org/D92734

Files:
  lld/MachO/Arch/X86_64.cpp


Index: lld/MachO/Arch/X86_64.cpp
===================================================================
--- lld/MachO/Arch/X86_64.cpp
+++ lld/MachO/Arch/X86_64.cpp
@@ -52,9 +52,8 @@
 
 static void validateLength(MemoryBufferRef mb, const section_64 &sec,
                            const relocation_info &rel,
-                           const std::vector<uint8_t> &validLengths) {
-  if (std::find(validLengths.begin(), validLengths.end(), rel.r_length) !=
-      validLengths.end())
+                           ArrayRef<uint8_t> validLengths) {
+  if (find(validLengths, rel.r_length) != validLengths.end())
     return;
 
   std::string msg = getErrorLocation(mb, sec, rel) + ": relocations of type " +


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92734.309781.patch
Type: text/x-patch
Size: 704 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201206/e0dcc06a/attachment.bin>


More information about the llvm-commits mailing list