[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
This commit is contained in:
Michael Gottesman 2013-07-08 23:30:23 +00:00
parent 7b934079c0
commit a75b293e4f

View 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);
}