[PATCH] D36090: [ELF] - Use multithreading for building .gdb_index.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 1 07:59:17 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL309688: [ELF] - Use multithreading for building .gdb_index. (authored by grimar).

Changed prior to commit:
  https://reviews.llvm.org/D36090?vs=109106&id=109121#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D36090

Files:
  lld/trunk/ELF/SyntheticSections.cpp


Index: lld/trunk/ELF/SyntheticSections.cpp
===================================================================
--- lld/trunk/ELF/SyntheticSections.cpp
+++ lld/trunk/ELF/SyntheticSections.cpp
@@ -1813,12 +1813,13 @@
 }
 
 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));
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36090.109121.patch
Type: text/x-patch
Size: 874 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170801/ca7e4877/attachment.bin>


More information about the llvm-commits mailing list