summaryrefslogtreecommitdiffstats
path: root/lld/ELF/OutputSections.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2016-10-20 10:55:58 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2016-10-20 10:55:58 +0000
commit113860b9aec24d8bf16314013e4ef9a693479562 (patch)
tree685e4ab823550f19953fd5f229aa537377d602d0 /lld/ELF/OutputSections.cpp
parent46aa89399dfb4aa3f63e36d4ca4b0e3791aba9e7 (diff)
downloadbcm5719-llvm-113860b9aec24d8bf16314013e4ef9a693479562.tar.gz
bcm5719-llvm-113860b9aec24d8bf16314013e4ef9a693479562.zip
Compact SectionPiece.
We allocate a lot of these when linking debug info. This speeds up the link of debug programs by 1% to 2%. llvm-svn: 284716
Diffstat (limited to 'lld/ELF/OutputSections.cpp')
-rw-r--r--lld/ELF/OutputSections.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp
index ffa8240f426..360d6520ae9 100644
--- a/lld/ELF/OutputSections.cpp
+++ b/lld/ELF/OutputSections.cpp
@@ -1188,7 +1188,7 @@ template <class ELFT> void EhOutputSection<ELFT>::finalize() {
Cie->Piece->OutputOff = Off;
Off += alignTo(Cie->Piece->size(), sizeof(uintX_t));
- for (SectionPiece *Fde : Cie->FdePieces) {
+ for (EhSectionPiece *Fde : Cie->FdePieces) {
Fde->OutputOff = Off;
Off += alignTo(Fde->size(), sizeof(uintX_t));
}
@@ -1281,11 +1281,15 @@ void MergeOutputSection<ELFT>::addSection(InputSectionBase<ELFT> *C) {
this->Header.sh_entsize = Sec->getSectionHdr()->sh_entsize;
Sections.push_back(Sec);
- for (SectionPiece &Piece : Sec->Pieces) {
+ auto HashI = Sec->Hashes.begin();
+ for (auto I = Sec->Pieces.begin(), E = Sec->Pieces.end(); I != E; ++I) {
+ SectionPiece &Piece = *I;
+ uint32_t Hash = *HashI;
+ ++HashI;
if (!Piece.Live)
continue;
- StringRef Data = toStringRef(Sec->getData(Piece));
- CachedHashStringRef V(Data, Piece.Hash);
+ StringRef Data = toStringRef(Sec->getData(I));
+ CachedHashStringRef V(Data, Hash);
uintX_t OutputOffset = Builder.add(V);
if (!shouldTailMerge())
Piece.OutputOff = OutputOffset;
OpenPOWER on IntegriCloud