From 7e366d2845da6d4974fededb0d034300b638fa66 Mon Sep 17 00:00:00 2001 From: Bob Wilson Date: Fri, 29 Mar 2013 23:28:55 +0000 Subject: [PATCH] Run the ObjCARCContract pass for LTO. llvm-svn: 178385 --- tools/lto/LTOCodeGenerator.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/lto/LTOCodeGenerator.cpp b/tools/lto/LTOCodeGenerator.cpp index cf7ffe28009..e7c83f94f53 100644 --- a/tools/lto/LTOCodeGenerator.cpp +++ b/tools/lto/LTOCodeGenerator.cpp @@ -44,6 +44,7 @@ #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Transforms/IPO.h" #include "llvm/Transforms/IPO/PassManagerBuilder.h" +#include "llvm/Transforms/ObjCARC.h" using namespace llvm; static cl::opt @@ -397,6 +398,10 @@ bool LTOCodeGenerator::generateObjectFile(raw_ostream &out, formatted_raw_ostream Out(out); + // If the bitcode files contain ARC code and were compiled with optimization, + // the ObjCARCContractPass must be run, so do it unconditionally here. + codeGenPasses.add(createObjCARCContractPass()); + if (_target->addPassesToEmitFile(codeGenPasses, Out, TargetMachine::CGFT_ObjectFile)) { errMsg = "target file type not supported";