aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/LTO/LTOBackend.cpp
diff options
context:
space:
mode:
authorJez Ng <jezng@fb.com>2021-01-12 14:41:56 -0500
committerJez Ng <jezng@fb.com>2021-01-20 14:21:32 -0500
commit697f4e429b900d2d3d8a03713c7d6cd562a5bd35 (patch)
treeffdbe6fbe08dbd64114ccabd58482c8d2dbf7598 /llvm/lib/LTO/LTOBackend.cpp
parentb3e73dc5af6b4d1438ea401a7ab60bfe298a53c6 (diff)
downloadllvm-697f4e429b900d2d3d8a03713c7d6cd562a5bd35.zip
llvm-697f4e429b900d2d3d8a03713c7d6cd562a5bd35.tar.gz
llvm-697f4e429b900d2d3d8a03713c7d6cd562a5bd35.tar.bz2
[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
Diffstat (limited to 'llvm/lib/LTO/LTOBackend.cpp')
-rw-r--r--llvm/lib/LTO/LTOBackend.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp
index effbdf6..8328224 100644
--- a/llvm/lib/LTO/LTOBackend.cpp
+++ b/llvm/lib/LTO/LTOBackend.cpp
@@ -428,6 +428,8 @@ static void codegen(const Config &Conf, TargetMachine *TM,
legacy::PassManager CodeGenPasses;
CodeGenPasses.add(
createImmutableModuleSummaryIndexWrapperPass(&CombinedIndex));
+ if (Conf.PreCodeGenPassesHook)
+ Conf.PreCodeGenPassesHook(CodeGenPasses);
if (TM->addPassesToEmitFile(CodeGenPasses, *Stream->OS,
DwoOut ? &DwoOut->os() : nullptr,
Conf.CGFileType))