[lld] r319927 - Convert a few uses of check to checkLazy.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 6 11:08:10 PST 2017


Author: rafael
Date: Wed Dec  6 11:08:10 2017
New Revision: 319927

URL: http://llvm.org/viewvc/llvm-project?rev=319927&view=rev
Log:
Convert a few uses of check to checkLazy.

Linking clang goes from 292.68MB to 281.80MB allocated.

Modified:
    lld/trunk/ELF/InputFiles.cpp

Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=319927&r1=319926&r2=319927&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Wed Dec  6 11:08:10 2017
@@ -253,13 +253,15 @@ StringRef ObjFile<ELFT>::getShtGroupSign
   // Group signatures are stored as symbol names in object files.
   // sh_info contains a symbol index, so we fetch a symbol and read its name.
   if (this->ELFSyms.empty())
-    this->initSymtab(
-        Sections,
-        check(object::getSection<ELFT>(Sections, Sec.sh_link), toString(this)));
+    this->initSymtab(Sections,
+                     checkLazy(object::getSection<ELFT>(Sections, Sec.sh_link),
+                               [=]() { return toString(this); }));
 
-  const Elf_Sym *Sym = check(
-      object::getSymbol<ELFT>(this->ELFSyms, Sec.sh_info), toString(this));
-  StringRef Signature = check(Sym->getName(this->StringTable), toString(this));
+  const Elf_Sym *Sym =
+      checkLazy(object::getSymbol<ELFT>(this->ELFSyms, Sec.sh_info),
+                [=]() { return toString(this); });
+  StringRef Signature = checkLazy(Sym->getName(this->StringTable),
+                                  [=]() { return toString(this); });
 
   // As a special case, if a symbol is a section symbol and has no name,
   // we use a section name as a signature.




More information about the llvm-commits mailing list