r236372 - Fix -fobjc-arc doesn't work with -save-temps

Steven Wu stevenwu at apple.com
Fri May 1 17:56:15 PDT 2015


Author: steven_wu
Date: Fri May  1 19:56:15 2015
New Revision: 236372

URL: http://llvm.org/viewvc/llvm-project?rev=236372&view=rev
Log:
Fix -fobjc-arc doesn't work with -save-temps

The underlying problem is that there is currently no way to run
ObjCARCContract from llvm bitcode which is required by ObjC ARC.
This fix the problem by always enable ObjCARCContract pass if
optimization is enabled. The ObjCARC Contract pass has almost no
overhead on code that is not using ARC.

Modified:
    cfe/trunk/lib/CodeGen/BackendUtil.cpp

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=236372&r1=236371&r2=236372&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Fri May  1 19:56:15 2015
@@ -571,8 +571,7 @@ bool EmitAssemblyHelper::AddEmitPasses(B
   // Add ObjC ARC final-cleanup optimizations. This is done as part of the
   // "codegen" passes so that it isn't run multiple times when there is
   // inlining happening.
-  if (LangOpts.ObjCAutoRefCount &&
-      CodeGenOpts.OptimizationLevel > 0)
+  if (CodeGenOpts.OptimizationLevel > 0)
     PM->add(createObjCARCContractPass());
 
   if (TM->addPassesToEmitFile(*PM, OS, CGFT,





More information about the cfe-commits mailing list