Added 2x Debug statements to ObjCARC that log when we handle the two undefined pointe...
authorMichael Gottesman <mgottesman@apple.com>
Sun, 6 Jan 2013 21:54:30 +0000 (21:54 +0000)
committerMichael Gottesman <mgottesman@apple.com>
Sun, 6 Jan 2013 21:54:30 +0000 (21:54 +0000)
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

lib/Transforms/Scalar/ObjCARC.cpp

index e68f2add73b856247c771a1c01f417a3b6254443..43f95191c6a457e7f28d9277ca12bcdaa4346a11 100644 (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;
       }