[objc-arc] Fix assertion in EraseInstruction so that noop on null calls when passed...
authorMichael Gottesman <mgottesman@apple.com>
Mon, 8 Jul 2013 23:30:23 +0000 (23:30 +0000)
committerMichael Gottesman <mgottesman@apple.com>
Mon, 8 Jul 2013 23:30:23 +0000 (23:30 +0000)
The specific case of interest is when objc_retainBlock is passed null.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185885 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/ObjCARC/ObjCARC.h

index 39670f339e9f3e93334ed169333482037465d53c..1462e85991a0659c54e3b1930dbaeeff788c8805 100644 (file)
@@ -286,7 +286,9 @@ static inline void EraseInstruction(Instruction *CI) {
 
   if (!Unused) {
     // Replace the return value with the argument.
-    assert(IsForwarding(GetBasicInstructionClass(CI)) &&
+    assert((IsForwarding(GetBasicInstructionClass(CI)) ||
+            (IsNoopOnNull(GetBasicInstructionClass(CI)) &&
+             isa<ConstantPointerNull>(OldArg))) &&
            "Can't delete non-forwarding instruction with users!");
     CI->replaceAllUsesWith(OldArg);
   }