Added 2x Debug statements to ObjCARC that log when we handle the two undefined pointer-to-weak-pointer is NULL cases by replacing the given call inst with an undefined value.

The reason that there are two cases is that the first case handles the unary cases and the second the binary cases.

llvm-svn: 171672
This commit is contained in:
Michael Gottesman 2013-01-06 21:54:30 +00:00
parent d326f6723a
commit fec61c018d
1 changed files with 16 additions and 2 deletions

View File

@ -2361,7 +2361,13 @@ void ObjCARCOpt::OptimizeIndividualCalls(Function &F) {
new StoreInst(UndefValue::get(cast<PointerType>(Ty)->getElementType()),
Constant::getNullValue(Ty),
CI);
CI->replaceAllUsesWith(UndefValue::get(CI->getType()));
llvm::Value *NewValue = UndefValue::get(CI->getType());
DEBUG(dbgs() << "ObjCARCOpt::OptimizeIndividualCalls: A null "
"pointer-to-weak-pointer is undefined behavior.\n"
" Old = " << *CI <<
"\n New = " <<
*NewValue << "\n");
CI->replaceAllUsesWith(NewValue);
CI->eraseFromParent();
continue;
}
@ -2377,7 +2383,15 @@ void ObjCARCOpt::OptimizeIndividualCalls(Function &F) {
new StoreInst(UndefValue::get(cast<PointerType>(Ty)->getElementType()),
Constant::getNullValue(Ty),
CI);
CI->replaceAllUsesWith(UndefValue::get(CI->getType()));
llvm::Value *NewValue = UndefValue::get(CI->getType());
DEBUG(dbgs() << "ObjCARCOpt::OptimizeIndividualCalls: A null "
"pointer-to-weak-pointer is undefined behavior.\n"
" Old = " << *CI <<
"\n New = " <<
*NewValue << "\n");
CI->replaceAllUsesWith(NewValue);
CI->eraseFromParent();
continue;
}