From: Michael Gottesman Date: Tue, 1 Jan 2013 16:05:54 +0000 (+0000) Subject: Added DEBUG message when ObjCARC replaces a call which returns its argument verbatim... X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=a6e23cc53585c09236feb12cb89e5dd0b461a6e0;p=oota-llvm.git 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 --- diff --git a/lib/Transforms/Scalar/ObjCARC.cpp b/lib/Transforms/Scalar/ObjCARC.cpp index 2bc7e2d1b7a..3c4aea13301 100644 --- a/lib/Transforms/Scalar/ObjCARC.cpp +++ b/lib/Transforms/Scalar/ObjCARC.cpp @@ -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(Inst)->getArgOperand(0)); + Value *Value = cast(Inst)->getArgOperand(0); + DEBUG(dbgs() << "ObjCARCExpand: Old = " << *Inst << "\n" + " New = " << *Value << "\n"); + Inst->replaceAllUsesWith(Value); break; + } default: break; }