summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Gottesman <mgottesman@apple.com>2013-01-06 21:54:30 +0000
committerMichael Gottesman <mgottesman@apple.com>2013-01-06 21:54:30 +0000
commite549492c3680814b31058b183d315d69fd9293de (patch)
tree5a8c27a5589d00ba952fb04f33708955978ed2c7
parentbe0ffd1e5a0784e9e7acfd32d3c582f6bb40c117 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171672 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Scalar/ObjCARC.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/ObjCARC.cpp b/lib/Transforms/Scalar/ObjCARC.cpp
index e68f2add73b..43f95191c6a 100644
--- a/lib/Transforms/Scalar/ObjCARC.cpp
+++ b/lib/Transforms/Scalar/ObjCARC.cpp
@@ -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;
}