[lld] r331075 - Don't create a temporary DenseMap for each input .eh_frame.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 27 13:19:28 PDT 2018


Author: rafael
Date: Fri Apr 27 13:19:28 2018
New Revision: 331075

URL: http://llvm.org/viewvc/llvm-project?rev=331075&view=rev
Log:
Don't create a temporary DenseMap for each input .eh_frame.

These maps are small, but we are creating an destroying one for each
input .eh_frame.

This patch reduces the total memory allocation from 765.54MB to
749.19MB. The peak is still the same: 563.7MB.

Modified:
    lld/trunk/ELF/SyntheticSections.cpp
    lld/trunk/ELF/SyntheticSections.h

Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=331075&r1=331074&r2=331075&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Fri Apr 27 13:19:28 2018
@@ -425,7 +425,7 @@ bool EhFrameSection::isFdeLive(EhSection
 // one and associates FDEs to the CIE.
 template <class ELFT, class RelTy>
 void EhFrameSection::addSectionAux(EhInputSection *Sec, ArrayRef<RelTy> Rels) {
-  DenseMap<size_t, CieRecord *> OffsetToCie;
+  OffsetToCie.clear();
   for (EhSectionPiece &Piece : Sec->Pieces) {
     // The empty record is the end marker.
     if (Piece.Size == 4)

Modified: lld/trunk/ELF/SyntheticSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.h?rev=331075&r1=331074&r2=331075&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.h (original)
+++ lld/trunk/ELF/SyntheticSections.h Fri Apr 27 13:19:28 2018
@@ -86,6 +86,10 @@ public:
   ArrayRef<CieRecord *> getCieRecords() const { return CieRecords; }
 
 private:
+  // This is used only when parsing EhInputSection. We keep it here to avoid
+  // allocating one for each EhInputSection.
+  llvm::DenseMap<size_t, CieRecord *> OffsetToCie;
+
   uint64_t Size = 0;
 
   template <class ELFT, class RelTy>




More information about the llvm-commits mailing list