ThinLTO: move ObjCARCContractPass in the CodeGen pipeline

This is to be coherent with Full LTO.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 265118
This commit is contained in:
Mehdi Amini 2016-04-01 08:22:59 +00:00
parent 7d15853c9f
commit 215d59e7b0
1 changed files with 6 additions and 1 deletions

View File

@ -160,7 +160,6 @@ static void optimizeModule(Module &TheModule, TargetMachine &TM) {
// Add optimizations // Add optimizations
PMB.populateThinLTOPassManager(PM); PMB.populateThinLTOPassManager(PM);
PM.add(createObjCARCContractPass());
PM.run(TheModule); PM.run(TheModule);
} }
@ -173,6 +172,12 @@ std::unique_ptr<MemoryBuffer> codegenModule(Module &TheModule,
{ {
raw_svector_ostream OS(OutputBuffer); raw_svector_ostream OS(OutputBuffer);
legacy::PassManager PM; legacy::PassManager PM;
// If the bitcode files contain ARC code and were compiled with optimization,
// the ObjCARCContractPass must be run, so do it unconditionally here.
PM.add(createObjCARCContractPass());
// Setup the codegen now.
if (TM.addPassesToEmitFile(PM, OS, TargetMachine::CGFT_ObjectFile, if (TM.addPassesToEmitFile(PM, OS, TargetMachine::CGFT_ObjectFile,
/* DisableVerify */ true)) /* DisableVerify */ true))
report_fatal_error("Failed to setup codegen"); report_fatal_error("Failed to setup codegen");