[lld] r309688 - [ELF] - Use multithreading for building .gdb_index.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 1 07:57:13 PDT 2017
Author: grimar
Date: Tue Aug 1 07:57:13 2017
New Revision: 309688
URL: http://llvm.org/viewvc/llvm-project?rev=309688&view=rev
Log:
[ELF] - Use multithreading for building .gdb_index.
Enables multithreaded .gdb_index building.
Differential revision: https://reviews.llvm.org/D36090
Modified:
lld/trunk/ELF/SyntheticSections.cpp
Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=309688&r1=309687&r2=309688&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Tue Aug 1 07:57:13 2017
@@ -1813,12 +1813,13 @@ static GdbIndexChunk readDwarf(DWARFCont
}
template <class ELFT> GdbIndexSection *elf::createGdbIndex() {
- std::vector<GdbIndexChunk> Chunks;
- for (InputSection *Sec : getDebugInfoSections()) {
- ObjFile<ELFT> *F = Sec->getFile<ELFT>();
+ std::vector<InputSection *> Sections = getDebugInfoSections();
+ std::vector<GdbIndexChunk> Chunks(Sections.size());
+ parallelForEachN(0, Chunks.size(), [&](size_t I) {
+ ObjFile<ELFT> *F = Sections[I]->getFile<ELFT>();
DWARFContext Dwarf(make_unique<LLDDwarfObj<ELFT>>(F));
- Chunks.push_back(readDwarf(Dwarf, Sec));
- }
+ Chunks[I] = readDwarf(Dwarf, Sections[I]);
+ });
return make<GdbIndexSection>(std::move(Chunks));
}
More information about the llvm-commits
mailing list