[lld-macho] Run ObjCContractPass during LTO
authorJez Ng <jezng@fb.com>
Tue, 12 Jan 2021 19:41:56 +0000 (14:41 -0500)
committerJez Ng <jezng@fb.com>
Wed, 20 Jan 2021 19:21:32 +0000 (14:21 -0500)
commit697f4e429b900d2d3d8a03713c7d6cd562a5bd35
treeffdbe6fbe08dbd64114ccabd58482c8d2dbf7598
parentb3e73dc5af6b4d1438ea401a7ab60bfe298a53c6
[lld-macho] Run ObjCContractPass during LTO

Run the ObjCARCContractPass during LTO. The legacy LTO backend (under
LTO/ThinLTOCodeGenerator.cpp) already does this; this diff just adds that
behavior to the new LTO backend. Without that pass, the objc.clang.arc.use
intrinsic will get passed to the instruction selector, which doesn't know how to
handle it.

In order to test both the new and old pass managers, I've also added support for
the `--[no-]lto-legacy-pass-manager` flags.

P.S. Not sure if the ordering of the pass within the pipeline matters...

Reviewed By: fhahn

Differential Revision: https://reviews.llvm.org/D94547
lld/MachO/Config.h
lld/MachO/Driver.cpp
lld/MachO/LTO.cpp
lld/MachO/Options.td
lld/test/MachO/objc-arc-contract.ll [new file with mode: 0644]
llvm/include/llvm/LTO/Config.h
llvm/lib/LTO/LTOBackend.cpp