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.

llvm-svn: 331075
This commit is contained in:
Rafael Espindola 2018-04-27 20:19:28 +00:00
parent a05e8d3e68
commit bd4d2acb11
2 changed files with 5 additions and 1 deletions

View File

@ -425,7 +425,7 @@ bool EhFrameSection::isFdeLive(EhSectionPiece &Fde, ArrayRef<RelTy> Rels) {
// 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)

View File

@ -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>