[PATCH] D81988: [ELF] Refactor ObjFile<ELFT>::initializeSymbols to enforce the invariant: InputFile::symbols has non null entry

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 22 00:29:49 PDT 2020


jhenderson added inline comments.


================
Comment at: lld/ELF/InputFiles.cpp:1101
+  // Symbol resolution of non-local symbols.
+  for (size_t i = firstGlobal, end = eSyms.size(); i != end; ++i) {
+    const Elf_Sym &eSym = eSyms[i];
----------------
MaskRay wrote:
> jhenderson wrote:
> > Isn't this going to result in reading every global symbol twice? That seems like a negative performance hit to me, and I'm not sure it's necessary either (the two loops could still be a single loop it seems to me).
> There were two loops before and two loops now. After refactoring there is strictly less work: the second loops starts from firstGlobal (was 0).
> 
> > (the two loops could still be a single loop it seems to me)
> 
> It will be very difficult.
Ah, sorry, the way the diff lined up made it look like only one loop on the left. Thanks.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81988/new/

https://reviews.llvm.org/D81988





More information about the llvm-commits mailing list