[PATCH] D46208: Don't create a temporary CieMap for each input .eh_frame

Rafael Avila de Espindola via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 27 13:07:21 PDT 2018


espindola created this revision.
espindola added reviewers: ruiu, grimar.
Herald added subscribers: arichardson, emaste.

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.


https://reviews.llvm.org/D46208

Files:
  ELF/SyntheticSections.cpp
  ELF/SyntheticSections.h


Index: ELF/SyntheticSections.h
===================================================================
--- ELF/SyntheticSections.h
+++ ELF/SyntheticSections.h
@@ -86,6 +86,7 @@
   ArrayRef<CieRecord *> getCieRecords() const { return CieRecords; }
 
 private:
+  llvm::DenseMap<size_t, CieRecord *> OffsetToCie;
   uint64_t Size = 0;
 
   template <class ELFT, class RelTy>
Index: ELF/SyntheticSections.cpp
===================================================================
--- ELF/SyntheticSections.cpp
+++ ELF/SyntheticSections.cpp
@@ -425,7 +425,7 @@
 // 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)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46208.144389.patch
Type: text/x-patch
Size: 894 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180427/f6d37bae/attachment.bin>


More information about the llvm-commits mailing list