[lld] r319932 - Convert a check to checkLazy.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 6 11:17:20 PST 2017
Author: rafael
Date: Wed Dec 6 11:17:20 2017
New Revision: 319932
URL: http://llvm.org/viewvc/llvm-project?rev=319932&view=rev
Log:
Convert a check to checkLazy.
This brings memory allocations when linking clang from 270.96MB to
267.80MB.
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=319932&r1=319931&r2=319932&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Wed Dec 6 11:17:20 2017
@@ -279,8 +279,9 @@ template <class ELFT>
ArrayRef<typename ObjFile<ELFT>::Elf_Word>
ObjFile<ELFT>::getShtGroupEntries(const Elf_Shdr &Sec) {
const ELFFile<ELFT> &Obj = this->getObj();
- ArrayRef<Elf_Word> Entries = check(
- Obj.template getSectionContentsAsArray<Elf_Word>(&Sec), toString(this));
+ ArrayRef<Elf_Word> Entries =
+ checkLazy(Obj.template getSectionContentsAsArray<Elf_Word>(&Sec),
+ [=]() { return toString(this); });
if (Entries.empty() || Entries[0] != GRP_COMDAT)
fatal(toString(this) + ": unsupported SHT_GROUP format");
return Entries.slice(1);
More information about the llvm-commits
mailing list