[lld-macho] Implement -why_live (without perf overhead)
authorJez Ng <jezng@fb.com>
Thu, 24 Feb 2022 20:39:59 +0000 (15:39 -0500)
committerJez Ng <jezng@fb.com>
Thu, 24 Feb 2022 20:49:36 +0000 (15:49 -0500)
commit850592ec14d0a5f2431aa780cb130d6ec20eb969
treec0e1879521e924d1d181c75afce2e8051006ff71
parentdf00a995f98e6c30b655757287e896e8a202c3ab
[lld-macho] Implement -why_live (without perf overhead)

This was based off @thakis' draft in {D103517}. I employed templates to ensure
the support for `-why_live` wouldn't slow down the regular non-why-live code
path.

No stat sig perf difference on my 3.2 GHz 16-Core Intel Xeon W:

             base           diff           difference (95% CI)
  sys_time   1.195 ± 0.015  1.199 ± 0.022  [  -0.4% ..   +1.0%]
  user_time  3.716 ± 0.022  3.701 ± 0.025  [  -0.7% ..   -0.1%]
  wall_time  4.606 ± 0.034  4.597 ± 0.046  [  -0.6% ..   +0.2%]
  samples    44             37

Reviewed By: #lld-macho, thakis

Differential Revision: https://reviews.llvm.org/D120377
lld/MachO/Config.h
lld/MachO/Driver.cpp
lld/MachO/MarkLive.cpp
lld/MachO/Options.td
lld/MachO/Symbols.h
lld/test/MachO/why-live.s [new file with mode: 0644]