From c1b648f6c01977a2c50ea77ece9885fe01ecd6a8 Mon Sep 17 00:00:00 2001 From: Michael Gottesman Date: Mon, 8 Jul 2013 23:30:23 +0000 Subject: [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. llvm-svn: 185885 --- llvm/lib/Transforms/ObjCARC/ObjCARC.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Transforms/ObjCARC') diff --git a/llvm/lib/Transforms/ObjCARC/ObjCARC.h b/llvm/lib/Transforms/ObjCARC/ObjCARC.h index 39670f339e9..1462e85991a 100644 --- a/llvm/lib/Transforms/ObjCARC/ObjCARC.h +++ b/llvm/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); } -- cgit v1.2.3