[lld] r319932 - Convert a check to checkLazy.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 6 12:29:04 PST 2017


It's getting too verbose. I'll try to do this in C macro.

On Wed, Dec 6, 2017 at 11:17 AM, Rafael Espindola via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> 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);
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171206/b5d89a67/attachment.html>


More information about the llvm-commits mailing list