[all-commits] [llvm/llvm-project] 1ff1d5: [ELF] Make InputFile smaller

Fangrui Song via All-commits all-commits at lists.llvm.org
Tue Dec 14 20:55:47 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1ff1d50d9f461e005085db5ec94d21f15d701a90
      https://github.com/llvm/llvm-project/commit/1ff1d50d9f461e005085db5ec94d21f15d701a90
  Author: Fangrui Song <i at maskray.me>
  Date:   2021-12-14 (Tue, 14 Dec 2021)

  Changed paths:
    M lld/ELF/Config.h
    M lld/ELF/InputFiles.cpp
    M lld/ELF/InputFiles.h
    M lld/ELF/InputSection.cpp

  Log Message:
  -----------
  [ELF] Make InputFile smaller

sizeof(ObjFile<ELF64LE>) is decreased from 344 to 272 on an ELF64 system.
In a large link with 30000 ObjFiles, this may be 2+MiB saving.

Change std::vector members to SmallVector, and std::string members to
SmallString<0> (these members typically don't benefit from small string optimization).
On Linux x86-64 the lld executable is ~6k smaller.




More information about the All-commits mailing list