[PATCH] D128093: [lld-macho] Initial support for Linker Optimization Hints

Daniel Bertalan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 28 08:40:35 PDT 2022


BertalanD updated this revision to Diff 440637.
BertalanD added a comment.

We are down to 130 ms!

  Benchmark 1: /Users/dani/Source/llvm-project/build_release/bin/ld64.lld @response.txt
    Time (mean ± σ):      3.828 s ±  0.021 s    [User: 5.182 s, System: 0.513 s]
    Range (min … max):    3.808 s …  3.877 s    10 runs
   
  Benchmark 2: /Users/dani/Source/llvm-project/build_release/bin/ld64.lld @response.txt -ignore_optimization_hints
    Time (mean ± σ):      3.718 s ±  0.048 s    [User: 5.047 s, System: 0.496 s]
    Range (min … max):    3.672 s …  3.831 s    10 runs
   
  Summary
    '/Users/dani/Source/llvm-project/build_release/bin/ld64.lld @response.txt -ignore_optimization_hints' ran
      1.03 ± 0.01 times faster than '/Users/dani/Source/llvm-project/build_release/bin/ld64.lld @response.txt'



- Reduced the size of `OptimizationHint` to 16 bytes by storing only 16 bit offsets to the second and third addresses like ld64 does. The first address cannot be stored in a smaller integer because it's only transformed into a section offset after LOHs have been sorted.
- Removed the redundant `PerformedRelocation` struct, now we only cache the resolved addresses.
- Use `O(reloc)` linear search for the first address, so only the second addresses have to be searched in `O(loh * log(reloc))` time.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128093/new/

https://reviews.llvm.org/D128093

Files:
  lld/MachO/Arch/ARM64.cpp
  lld/MachO/Config.h
  lld/MachO/Driver.cpp
  lld/MachO/InputFiles.cpp
  lld/MachO/InputFiles.h
  lld/MachO/InputSection.cpp
  lld/MachO/InputSection.h
  lld/MachO/Options.td
  lld/MachO/Relocations.h
  lld/MachO/Target.h
  lld/test/MachO/loh-adrp-add.s
  lld/test/MachO/loh-adrp-adrp.s
  llvm/include/llvm/BinaryFormat/MachO.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128093.440637.patch
Type: text/x-patch
Size: 22860 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220628/e4d65688/attachment.bin>


More information about the llvm-commits mailing list