mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
Fix assert in ObjCARC optimizer when deleting retainBlock of null or undef.
The caller to EraseInstruction had this conditional: // ARC calls with null are no-ops. Delete them. if (IsNullOrUndef(Arg)) but the assert inside EraseInstruction only allowed ConstantPointerNull and not undef or bitcasts. This adds support for both of these cases. rdar://problem/47003805 llvm-svn: 350261
This commit is contained in:
parent
cad75f35f4
commit
3f14a0615c
@ -58,7 +58,7 @@ static inline void EraseInstruction(Instruction *CI) {
|
||||
// Replace the return value with the argument.
|
||||
assert((IsForwarding(GetBasicARCInstKind(CI)) ||
|
||||
(IsNoopOnNull(GetBasicARCInstKind(CI)) &&
|
||||
isa<ConstantPointerNull>(OldArg))) &&
|
||||
IsNullOrUndef(OldArg->stripPointerCasts()))) &&
|
||||
"Can't delete non-forwarding instruction with users!");
|
||||
CI->replaceAllUsesWith(OldArg);
|
||||
}
|
||||
|
@ -61,6 +61,11 @@ define void @test2() {
|
||||
call i8* @llvm.objc.retainAutoreleasedReturnValue(i8* null)
|
||||
call i8* @llvm.objc.autoreleaseReturnValue(i8* null)
|
||||
; call i8* @llvm.objc.retainAutoreleaseReturnValue(i8* null) ; TODO
|
||||
%bitcast = bitcast i32* null to i8*
|
||||
%rb = call i8* @llvm.objc.retainBlock(i8* %bitcast)
|
||||
call void @use_pointer(i8* %rb)
|
||||
%rb2 = call i8* @llvm.objc.retainBlock(i8* undef)
|
||||
call void @use_pointer(i8* %rb2)
|
||||
ret void
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user