aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/ObjCARC
diff options
context:
space:
mode:
authorMichael Gottesman <mgottesman@apple.com>2013-07-08 23:30:23 +0000
committerMichael Gottesman <mgottesman@apple.com>2013-07-08 23:30:23 +0000
commita75b293e4fa702d3e233839dc347ebf565be2d4d (patch)
tree76f83984245441d9fc7446fe96761d1679228b28 /lib/Transforms/ObjCARC
parent7b934079c044311c56ebf3809c8c0047d88f825a (diff)
downloadexternal_llvm-a75b293e4fa702d3e233839dc347ebf565be2d4d.zip
external_llvm-a75b293e4fa702d3e233839dc347ebf565be2d4d.tar.gz
external_llvm-a75b293e4fa702d3e233839dc347ebf565be2d4d.tar.bz2
[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
Diffstat (limited to 'lib/Transforms/ObjCARC')
-rw-r--r--lib/Transforms/ObjCARC/ObjCARC.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Transforms/ObjCARC/ObjCARC.h b/lib/Transforms/ObjCARC/ObjCARC.h
index 39670f3..1462e85 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<ConstantPointerNull>(OldArg))) &&
"Can't delete non-forwarding instruction with users!");
CI->replaceAllUsesWith(OldArg);
}