[lld] bf4fa30 - [ELF] Use SmallVector for MergeInputSection::pieces. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 16 21:07:45 PST 2021


Author: Fangrui Song
Date: 2021-12-16T21:07:39-08:00
New Revision: bf4fa3036aec8a6b41431d1e4e4fd3e7e52c4482

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

LOG: [ELF] Use SmallVector for MergeInputSection::pieces. NFC

sizeof(pieces) decreases from 24 to 16 on ELF64.
One BumpPtrAllocator can store more MergeInputSections.
The lld executable becomes smaller.

Added: 
    

Modified: 
    lld/ELF/InputSection.h

Removed: 
    


################################################################################
diff  --git a/lld/ELF/InputSection.h b/lld/ELF/InputSection.h
index 7ddc43916a0f..70bbe4975a38 100644
--- a/lld/ELF/InputSection.h
+++ b/lld/ELF/InputSection.h
@@ -278,7 +278,7 @@ class MergeInputSection : public InputSectionBase {
 
   // Splittable sections are handled as a sequence of data
   // rather than a single large blob of data.
-  std::vector<SectionPiece> pieces;
+  SmallVector<SectionPiece, 0> pieces;
 
   // Returns I'th piece's data. This function is very hot when
   // string merging is enabled, so we want to inline.


        


More information about the llvm-commits mailing list