[lld] feadc37 - [lld/mac] Make X86_64::getImplicitAddend not do heap allocations

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 7 06:28:54 PST 2020


Author: Nico Weber
Date: 2020-12-07T09:23:51-05:00
New Revision: feadc3798d9ab123057a7a1064897188ac8de934

URL: https://github.com/llvm/llvm-project/commit/feadc3798d9ab123057a7a1064897188ac8de934
DIFF: https://github.com/llvm/llvm-project/commit/feadc3798d9ab123057a7a1064897188ac8de934.diff

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

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)

Differential Revision: https://reviews.llvm.org/D92734

Added: 
    

Modified: 
    lld/MachO/Arch/X86_64.cpp

Removed: 
    


################################################################################
diff  --git a/lld/MachO/Arch/X86_64.cpp b/lld/MachO/Arch/X86_64.cpp
index 19e62a919caf..7f4024cc998d 100644
--- a/lld/MachO/Arch/X86_64.cpp
+++ b/lld/MachO/Arch/X86_64.cpp
@@ -52,9 +52,8 @@ static std::string getErrorLocation(MemoryBufferRef mb, const section_64 &sec,
 
 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 " +


        


More information about the llvm-commits mailing list