[PATCH] D105305: [lld-macho] Factor out common InputSection members

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 1 12:06:07 PDT 2021


int3 created this revision.
int3 added a reviewer: lld-macho.
Herald added a reviewer: gkm.
Herald added a project: lld-macho.
int3 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

We have been creating many ConcatInputSections with identical values due
to .subsections_via_symbols. This diff factors out the identical values
into a Shared struct, to reduce memory consumption and make copying
cheaper.

I also changed `callSiteCount` from a uint32_t to a uint16_t to save an
extra word.

All in all, this takes InputSection from 120 to 72 bytes (and
ConcatInputSection from 160 to 112 bytes), i.e. 30% size reduction in
ConcatInputSection.

Numbers for linking chromium_framework on my 3.2 GHz 16-Core Intel Xeon W:

      N           Min           Max        Median           Avg        Stddev
  x  20          4.14          4.24          4.18         4.183   0.027548999
  +  20          4.04          4.11         4.075        4.0775   0.018027756
  Difference at 95.0% confidence
          -0.1055 +/- 0.0149005
          -2.52211% +/- 0.356215%
          (Student's t, pooled s = 0.0232803)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D105305

Files:
  lld/MachO/ConcatOutputSection.cpp
  lld/MachO/Driver.cpp
  lld/MachO/Dwarf.cpp
  lld/MachO/ICF.cpp
  lld/MachO/InputFiles.cpp
  lld/MachO/InputSection.cpp
  lld/MachO/InputSection.h
  lld/MachO/MarkLive.cpp
  lld/MachO/Symbols.h
  lld/MachO/SyntheticSections.cpp
  lld/MachO/UnwindInfoSection.cpp
  lld/MachO/Writer.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105305.355969.patch
Type: text/x-patch
Size: 19350 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210701/c6042101/attachment.bin>


More information about the llvm-commits mailing list