mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
[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
This commit is contained in:
parent
21cfd88ff2
commit
248ae4d5bc
@ -19,6 +19,7 @@
|
||||
#include "llvm/IR/DiagnosticInfo.h"
|
||||
#include "llvm/IR/GlobalValue.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/LegacyPassManager.h"
|
||||
#include "llvm/Passes/PassBuilder.h"
|
||||
#include "llvm/Support/CodeGen.h"
|
||||
#include "llvm/Target/TargetOptions.h"
|
||||
@ -43,6 +44,8 @@ struct Config {
|
||||
TargetOptions Options;
|
||||
std::vector<std::string> MAttrs;
|
||||
std::vector<std::string> PassPlugins;
|
||||
/// For adding passes that run right before codegen.
|
||||
std::function<void(legacy::PassManager &)> PreCodeGenPassesHook;
|
||||
Optional<Reloc::Model> RelocModel = Reloc::PIC_;
|
||||
Optional<CodeModel::Model> CodeModel = None;
|
||||
CodeGenOpt::Level CGOptLevel = CodeGenOpt::Default;
|
||||
|
@ -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))
|
||||
|
Loading…
x
Reference in New Issue
Block a user