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

Michael Gottesman mgottesman at apple.com
Tue Jan 15 22:32:39 PST 2013


Author: mgottesman
Date: Wed Jan 16 00:32:39 2013
New Revision: 172599

URL: http://llvm.org/viewvc/llvm-project?rev=172599&view=rev
Log:
[ObjCARC] Turn off ignoring unwind edges in ObjCARC when -fno-objc-arc-exception is enabled due to it's affect on correctness.

Specifically according to the semantics of ARC -fno-objc-arc-exception simply
states that it is expected that the unwind path out of a call *MAY* not release
objects. Thus we can have the situation where a release gets moved into a catch
block which we ignore when we remove a retain/release pair resulting in (even
though we assume the program is exiting anyways) the cleanup code path
potentially blowing up before program exit.

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=172599&r1=172598&r2=172599&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/ObjCARC.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/ObjCARC.cpp Wed Jan 16 00:32:39 2013
@@ -2675,17 +2675,6 @@
       PtrState &S = I->second;
       succ_const_iterator SI(TI), SE(TI, false);
 
-      // If the terminator is an invoke marked with the
-      // clang.arc.no_objc_arc_exceptions metadata, the unwind edge can be
-      // ignored, for ARC purposes.
-      if (isa<InvokeInst>(TI) && TI->getMetadata(NoObjCARCExceptionsMDKind)) {
-        DEBUG(dbgs() << "ObjCARCOpt::CheckForCFGHazards: Found an invoke "
-                        "terminator marked with "
-                        "clang.arc.no_objc_arc_exceptions. Ignoring unwind "
-                        "edge.\n");
-        --SE;
-      }
-
       for (; SI != SE; ++SI) {
         Sequence SuccSSeq = S_None;
         bool SuccSRRIKnownSafe = false;
@@ -2734,17 +2723,6 @@
       PtrState &S = I->second;
       succ_const_iterator SI(TI), SE(TI, false);
 
-      // If the terminator is an invoke marked with the
-      // clang.arc.no_objc_arc_exceptions metadata, the unwind edge can be
-      // ignored, for ARC purposes.
-      if (isa<InvokeInst>(TI) && TI->getMetadata(NoObjCARCExceptionsMDKind)) {
-        DEBUG(dbgs() << "ObjCARCOpt::CheckForCFGHazards: Found an invoke "
-                        "terminator marked with "
-                        "clang.arc.no_objc_arc_exceptions. Ignoring unwind "
-                        "edge.\n");
-        --SE;
-      }
-
       for (; SI != SE; ++SI) {
         Sequence SuccSSeq = S_None;
         bool SuccSRRIKnownSafe = false;
@@ -3199,17 +3177,6 @@
     TerminatorInst *TI = cast<TerminatorInst>(&CurrBB->back());
     succ_iterator SE(TI, false);
 
-    // If the terminator is an invoke marked with the
-    // clang.arc.no_objc_arc_exceptions metadata, the unwind edge can be
-    // ignored, for ARC purposes.
-    if (isa<InvokeInst>(TI) && TI->getMetadata(NoObjCARCExceptionsMDKind)) {
-        DEBUG(dbgs() << "ObjCARCOpt::ComputePostOrders: Found an invoke "
-                        "terminator marked with "
-                        "clang.arc.no_objc_arc_exceptions. Ignoring unwind "
-                        "edge.\n");
-      --SE;
-    }
-
     while (SuccStack.back().second != SE) {
       BasicBlock *SuccBB = *SuccStack.back().second++;
       if (Visited.insert(SuccBB)) {





More information about the llvm-commits mailing list