Lines Matching full:retain
89 bool optimizeRetainCall(Function &F, Instruction *Retain);
123 bool ObjCARCContract::optimizeRetainCall(Function &F, Instruction *Retain) { in optimizeRetainCall() argument
124 const auto *Call = dyn_cast<CallBase>(GetArgRCIdentityRoot(Retain)); in optimizeRetainCall()
127 if (Call->getParent() != Retain->getParent()) in optimizeRetainCall()
130 // Check that the call is next to the retain. in optimizeRetainCall()
134 if (&*I != Retain) in optimizeRetainCall()
145 << *Retain << "\n"); in optimizeRetainCall()
148 // retain/retainRV have the same properties. in optimizeRetainCall()
150 cast<CallInst>(Retain)->setCalledFunction(Decl); in optimizeRetainCall()
152 LLVM_DEBUG(dbgs() << "New: " << *Retain << "\n"); in optimizeRetainCall()
156 /// Merge an autorelease with a retain into a fused call.
161 // Check that there are no instructions between the retain and the autorelease in contractAutorelease()
166 auto *Retain = dyn_cast_or_null<CallInst>( in contractAutorelease() local
169 if (!Retain || GetBasicARCInstKind(Retain) != ARCInstKind::Retain || in contractAutorelease()
170 GetArgRCIdentityRoot(Retain) != Arg) in contractAutorelease()
176 LLVM_DEBUG(dbgs() << " Fusing retain/autorelease!\n" in contractAutorelease()
180 " Retain: " in contractAutorelease()
181 << *Retain << "\n"); in contractAutorelease()
186 Retain->setCalledFunction(Decl); in contractAutorelease()
188 LLVM_DEBUG(dbgs() << " New RetainAutorelease: " << *Retain << "\n"); in contractAutorelease()
243 // If Inst is a retain, we don't care about it as it doesn't prevent moving in findSafeStoreForStoreStrongContraction()
287 // Walk up from the Store to find the retain. in findRetainForStoreStrongContraction()
290 while (I != Begin && GetBasicARCInstKind(&*I) != ARCInstKind::Retain) { in findRetainForStoreStrongContraction()
293 // It is only safe to move the retain to the store if we can prove in findRetainForStoreStrongContraction()
295 // counts in between the retain and the store. in findRetainForStoreStrongContraction()
300 Instruction *Retain = &*I; in findRetainForStoreStrongContraction() local
301 if (GetBasicARCInstKind(Retain) != ARCInstKind::Retain) in findRetainForStoreStrongContraction()
303 if (GetArgRCIdentityRoot(Retain) != New) in findRetainForStoreStrongContraction()
305 return Retain; in findRetainForStoreStrongContraction()
331 /// optimization it must be safe to move the retain, load, and release to
359 // Then walk up the BB and look for a retain on New without any intervening in tryToContractReleaseIntoStoreStrong()
361 Instruction *Retain = in tryToContractReleaseIntoStoreStrong() local
365 if (!Retain) in tryToContractReleaseIntoStoreStrong()
372 llvm::dbgs() << " Contracting retain, release into objc_storeStrong.\n" in tryToContractReleaseIntoStoreStrong()
376 << " Retain: " << *Retain << "\n" in tryToContractReleaseIntoStoreStrong()
402 if (&*Iter == Retain) ++Iter; in tryToContractReleaseIntoStoreStrong()
406 EraseInstruction(Retain); in tryToContractReleaseIntoStoreStrong()
425 case ARCInstKind::Retain: in tryToPeepholeInstruction()