Added DEBUG message when ObjCARC replaces a call which returns its argument verbatim...
authorMichael Gottesman <mgottesman@apple.com>
Tue, 1 Jan 2013 16:05:54 +0000 (16:05 +0000)
committerMichael Gottesman <mgottesman@apple.com>
Tue, 1 Jan 2013 16:05:54 +0000 (16:05 +0000)
Specifically these calls return their argument verbatim, as a low-level
optimization. However, this makes high-level optimizations
harder. We undo any uses of this optimization that the front-end
emitted. We redo them later in the contract pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171346 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/ObjCARC.cpp

index 2bc7e2d1b7abc3fb3efb7f2c57949e1fff31ed6e..3c4aea13301e6e7a32a86825ba15715048a95f97 100644 (file)
@@ -895,14 +895,18 @@ bool ObjCARCExpand::runOnFunction(Function &F) {
     case IC_Autorelease:
     case IC_AutoreleaseRV:
     case IC_FusedRetainAutorelease:
-    case IC_FusedRetainAutoreleaseRV:
+    case IC_FusedRetainAutoreleaseRV: {
       // These calls return their argument verbatim, as a low-level
       // optimization. However, this makes high-level optimizations
       // harder. Undo any uses of this optimization that the front-end
       // emitted here. We'll redo them in the contract pass.
       Changed = true;
-      Inst->replaceAllUsesWith(cast<CallInst>(Inst)->getArgOperand(0));
+      Value *Value = cast<CallInst>(Inst)->getArgOperand(0);
+      DEBUG(dbgs() << "ObjCARCExpand: Old = " << *Inst << "\n"
+                      "               New = " << *Value << "\n");
+      Inst->replaceAllUsesWith(Value);
       break;
+    }
     default:
       break;
     }