[lld] r284487 - Use reserve instead of grow.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 18 08:31:23 PDT 2016

Author: rafael
Date: Tue Oct 18 10:31:23 2016
New Revision: 284487

URL: http://llvm.org/viewvc/llvm-project?rev=284487&view=rev
Use reserve instead of grow.

The table was still being resized as grow doesn't account for the fact
that the table needs to remain 3/4 full.


Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=284487&r1=284486&r2=284487&view=diff
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Tue Oct 18 10:31:23 2016
@@ -691,7 +691,7 @@ typename ELFT::uint MergeInputSection<EL
 // Create a map from input offsets to output offsets for all section pieces.
 // It is called after finalize().
 template <class ELFT> void  MergeInputSection<ELFT>::finalizePieces() {
-  OffsetMap.grow(this->Pieces.size());
+  OffsetMap.reserve(this->Pieces.size());
   for (SectionPiece &Piece : this->Pieces) {
     if (!Piece.Live)

More information about the llvm-commits mailing list