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

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 1 05:52:35 PDT 2017


ruiu added inline comments.


================
Comment at: ELF/SyntheticSections.cpp:1816
 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());
----------------
InfoSections -> Sections.


================
Comment at: ELF/SyntheticSections.cpp:1819
+  parallelForEachN(0, Chunks.size(), [&](size_t I) {
+    InputSection *Sec = InfoSections[I];
+    DWARFContext Dwarf(make_unique<LLDDwarfObj<ELFT>>(Sec->getFile<ELFT>()));
----------------
No need to change the original code.

  ObjFile<ELFT> *F = Sections[I]->getFile<ELFT>();
  DWARFContext Dwarf(make_unique<LLDDwarfObj<ELFT>>(F));
  Chunks[I] = readDwarf(Dwarf, Sections[I]);



https://reviews.llvm.org/D36090





More information about the llvm-commits mailing list