[PATCH] D102972: [lld-macho][nfc] Sort OutputSections based on explicit order of command-line inputs

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 22 17:52:27 PDT 2021


int3 created this revision.
int3 added a reviewer: lld-macho.
Herald added a subscriber: mgrang.
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.

This diff paves the way for D102964: [lld-macho] Implement cstring merging / deduplication <https://reviews.llvm.org/D102964> which adds a new kind of
InputSection.

We previously maintained section ordering implicitly: we created
InputSections as we parsed each file in command-line order, and passed
on this ordering when we created OutputSections and OutputSegments by
iterating over these InputSections. The implicitness of the ordering
made it difficult to refactor the code to e.g. handle a new type of
InputSection. As such, I've codified the ordering explicitly via
`inputOrder` fields. This also allows us to use `sort` instead of
`stable_sort`.

Benchmarking chromium_framework on my 3.2 GHz 16-Core Intel Xeon W:

      N           Min           Max        Median           Avg        Stddev
  x  20          4.23          4.35          4.27         4.274   0.030157481
  +  20          4.24          4.38          4.27        4.2815   0.033759989
  No difference proven at 95.0% confidence


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102972

Files:
  lld/MachO/OutputSection.h
  lld/MachO/OutputSegment.cpp
  lld/MachO/OutputSegment.h
  lld/MachO/Writer.cpp
  lld/test/MachO/load-command-sequence.s
  lld/test/MachO/section-order.s
  lld/test/MachO/weak-binding.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102972.347219.patch
Type: text/x-patch
Size: 8861 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210523/fc96249b/attachment.bin>


More information about the llvm-commits mailing list