Run the ObjCARCContract pass for LTO. <rdar://problem/13538084>
authorBob Wilson <bob.wilson@apple.com>
Fri, 29 Mar 2013 23:28:55 +0000 (23:28 +0000)
committerBob Wilson <bob.wilson@apple.com>
Fri, 29 Mar 2013 23:28:55 +0000 (23:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178385 91177308-0d34-0410-b5e6-96231b3b80d8

tools/lto/LTOCodeGenerator.cpp

index cf7ffe28009e42e690294f980f7c2347b1da21f9..e7c83f94f5366bf6a06a5840cbb92c47cff7f51f 100644 (file)
@@ -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<bool>
@@ -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";