From 215d59e7b0b14968c2f0c33c6575373455a84359 Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Fri, 1 Apr 2016 08:22:59 +0000 Subject: [PATCH] ThinLTO: move ObjCARCContractPass in the CodeGen pipeline This is to be coherent with Full LTO. From: Mehdi Amini llvm-svn: 265118 --- llvm/lib/LTO/ThinLTOCodeGenerator.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp index 412475d..b867976 100644 --- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp +++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp @@ -160,7 +160,6 @@ static void optimizeModule(Module &TheModule, TargetMachine &TM) { // Add optimizations PMB.populateThinLTOPassManager(PM); - PM.add(createObjCARCContractPass()); PM.run(TheModule); } @@ -173,6 +172,12 @@ std::unique_ptr codegenModule(Module &TheModule, { raw_svector_ostream OS(OutputBuffer); 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, /* DisableVerify */ true)) report_fatal_error("Failed to setup codegen"); -- 2.7.4