Added DEBUG message when ObjCARC replaces a call which returns its argument verbatim with its argument to temporarily undo an optimization.

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
This commit is contained in:
Michael Gottesman 2013-01-01 16:05:54 +00:00
parent 8f22c8b5e1
commit a6e23cc535

View 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;
}