summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/ObjCARC.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Scalar/ObjCARC.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/ObjCARC.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/ObjCARC.cpp b/llvm/lib/Transforms/Scalar/ObjCARC.cpp
index e68f2add73b..43f95191c6a 100644
--- a/llvm/lib/Transforms/Scalar/ObjCARC.cpp
+++ b/llvm/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;
}
OpenPOWER on IntegriCloud