[llvm-commits] [llvm] r139710 - /llvm/trunk/lib/Transforms/Scalar/ObjCARC.cpp

Dan Gohman gohman at apple.com
Wed Sep 14 11:33:34 PDT 2011


Author: djg
Date: Wed Sep 14 13:33:34 2011
New Revision: 139710

URL: http://llvm.org/viewvc/llvm-project?rev=139710&view=rev
Log:
Don't mark objc_retainBlock as nounwind. It calls user copy constructors
which could theoretically throw.

Modified:
    llvm/trunk/lib/Transforms/Scalar/ObjCARC.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/ObjCARC.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ObjCARC.cpp?rev=139710&r1=139709&r2=139710&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/ObjCARC.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/ObjCARC.cpp Wed Sep 14 13:33:34 2011
@@ -425,9 +425,10 @@
 /// IsNoThrow - Test if the given class represents instructions which are always
 /// safe to mark with the nounwind attribute..
 static bool IsNoThrow(InstructionClass Class) {
+  // objc_retainBlock is not nounwind because it calls user copy constructors
+  // which could theoretically throw.
   return Class == IC_Retain ||
          Class == IC_RetainRV ||
-         Class == IC_RetainBlock ||
          Class == IC_Release ||
          Class == IC_Autorelease ||
          Class == IC_AutoreleaseRV ||
@@ -1605,7 +1606,8 @@
     std::vector<Type *> Params;
     Params.push_back(PointerType::getUnqual(Type::getInt8Ty(C)));
     AttrListPtr Attributes;
-    Attributes.addAttr(~0u, Attribute::NoUnwind);
+    // objc_retainBlock is not nounwind because it calls user copy constructors
+    // which could theoretically throw.
     RetainBlockCallee =
       M->getOrInsertFunction(
         "objc_retainBlock",





More information about the llvm-commits mailing list