From: Michael Gottesman Date: Mon, 8 Jul 2013 23:30:23 +0000 (+0000) Subject: [objc-arc] Fix assertion in EraseInstruction so that noop on null calls when passed... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a75b293e4fa702d3e233839dc347ebf565be2d4d;p=oota-llvm.git [objc-arc] Fix assertion in EraseInstruction so that noop on null calls when passed null do not trigger the assert. 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 --- diff --git a/lib/Transforms/ObjCARC/ObjCARC.h b/lib/Transforms/ObjCARC/ObjCARC.h index 39670f339e9..1462e85991a 100644 --- a/lib/Transforms/ObjCARC/ObjCARC.h +++ b/lib/Transforms/ObjCARC/ObjCARC.h @@ -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(OldArg))) && "Can't delete non-forwarding instruction with users!"); CI->replaceAllUsesWith(OldArg); }