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

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 31 07:32:56 PDT 2017


grimar created this revision.
Herald added a subscriber: emaste.

Looks it is can be enabled now.


https://reviews.llvm.org/D36090

Files:
  ELF/SyntheticSections.cpp


Index: ELF/SyntheticSections.cpp
===================================================================
--- ELF/SyntheticSections.cpp
+++ 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>();
-    DWARFContext Dwarf(make_unique<LLDDwarfObj<ELFT>>(F));
-    Chunks.push_back(readDwarf(Dwarf, Sec));
-  }
+  std::vector<InputSection *> InfoSections = getDebugInfoSections();
+  std::vector<GdbIndexChunk> Chunks(InfoSections.size());
+  parallelForEachN(0, Chunks.size(), [&](size_t I) {
+    InputSection *Sec = InfoSections[I];
+    DWARFContext Dwarf(make_unique<LLDDwarfObj<ELFT>>(Sec->getFile<ELFT>()));
+    Chunks[I] = readDwarf(Dwarf, Sec);
+  });
   return make<GdbIndexSection>(std::move(Chunks));
 }
 


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


More information about the llvm-commits mailing list