[llvm] r185885 - [objc-arc] Fix assertion in EraseInstruction so that noop on null calls when passed null do not trigger the assert.
Michael Gottesman
mgottesman at apple.com
Mon Jul 8 16:30:23 PDT 2013
Author: mgottesman
Date: Mon Jul 8 18:30:23 2013
New Revision: 185885
URL: http://llvm.org/viewvc/llvm-project?rev=185885&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/Transforms/ObjCARC/ObjCARC.h
Modified: llvm/trunk/lib/Transforms/ObjCARC/ObjCARC.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/ObjCARC/ObjCARC.h?rev=185885&r1=185884&r2=185885&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/ObjCARC/ObjCARC.h (original)
+++ llvm/trunk/lib/Transforms/ObjCARC/ObjCARC.h Mon Jul 8 18:30:23 2013
@@ -286,7 +286,9 @@ static inline void EraseInstruction(Inst
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);
}
More information about the llvm-commits
mailing list