Lines Matching defs:Retain
70 bool OptimizeRetainCall(Function &F, Instruction *Retain);
116 ObjCARCContract::OptimizeRetainCall(Function &F, Instruction *Retain) {
117 ImmutableCallSite CS(GetObjCArg(Retain));
121 if (Call->getParent() != Retain->getParent())
124 // Check that the call is next to the retain.
128 if (&*I != Retain)
137 "return value.\nOld: "<< *Retain << "\n");
140 // retain/retainRV have the same properties.
142 cast<CallInst>(Retain)->setCalledFunction(Decl);
144 DEBUG(dbgs() << "New: " << *Retain << "\n");
148 /// Merge an autorelease with a retain into a fused call.
158 // Check that there are no instructions between the retain and the autorelease
160 CallInst *Retain = 0;
176 Retain = dyn_cast_or_null<CallInst>(*DependingInstructions.begin());
179 if (!Retain ||
180 GetBasicInstructionClass(Retain) != IC_Retain ||
181 GetObjCArg(Retain) != Arg)
188 "retain/autorelease. Erasing: " << *Autorelease << "\n"
189 " Old Retain: "
190 << *Retain << "\n");
195 Retain->setCalledFunction(Decl);
197 DEBUG(dbgs() << " New Retain: "
198 << *Retain << "\n");
255 // Walk up to find the retain.
260 Instruction *Retain = I;
261 if (GetBasicInstructionClass(Retain) != IC_Retain) return;
262 if (GetObjCArg(Retain) != New) return;
289 EraseInstruction(Retain);