Lines Matching refs:CB
89 bool isMustTailCalleeAnalyzable(const CallBase &CB) { in isMustTailCalleeAnalyzable() argument
90 assert(CB.isMustTailCall()); in isMustTailCalleeAnalyzable()
91 return CB.getCalledFunction() && !CB.getCalledFunction()->isDeclaration(); in isMustTailCalleeAnalyzable()
184 CallBase *CB = dyn_cast<CallBase>(U); in deleteDeadVarargs() local
185 if (!CB) in deleteDeadVarargs()
189 Args.assign(CB->arg_begin(), CB->arg_begin() + NumArgs); in deleteDeadVarargs()
192 AttributeList PAL = CB->getAttributes(); in deleteDeadVarargs()
202 CB->getOperandBundlesAsDefs(OpBundles); in deleteDeadVarargs()
205 if (InvokeInst *II = dyn_cast<InvokeInst>(CB)) { in deleteDeadVarargs()
207 Args, OpBundles, "", CB->getIterator()); in deleteDeadVarargs()
209 NewCB = CallInst::Create(NF, Args, OpBundles, "", CB->getIterator()); in deleteDeadVarargs()
211 cast<CallInst>(CB)->getTailCallKind()); in deleteDeadVarargs()
213 NewCB->setCallingConv(CB->getCallingConv()); in deleteDeadVarargs()
215 NewCB->copyMetadata(*CB, {LLVMContext::MD_prof, LLVMContext::MD_dbg}); in deleteDeadVarargs()
219 if (!CB->use_empty()) in deleteDeadVarargs()
220 CB->replaceAllUsesWith(NewCB); in deleteDeadVarargs()
222 NewCB->takeName(CB); in deleteDeadVarargs()
226 CB->eraseFromParent(); in deleteDeadVarargs()
316 CallBase *CB = dyn_cast<CallBase>(U.getUser()); in removeDeadArgumentsFromCallers() local
317 if (!CB || !CB->isCallee(&U) || in removeDeadArgumentsFromCallers()
318 CB->getFunctionType() != F.getFunctionType()) in removeDeadArgumentsFromCallers()
323 Value *Arg = CB->getArgOperand(ArgNo); in removeDeadArgumentsFromCallers()
324 CB->setArgOperand(ArgNo, PoisonValue::get(Arg->getType())); in removeDeadArgumentsFromCallers()
325 CB->removeParamAttrs(ArgNo, UBImplyingAttributes); in removeDeadArgumentsFromCallers()
435 if (const auto *CB = dyn_cast<CallBase>(V)) { in surveyUse() local
436 const Function *F = CB->getCalledFunction(); in surveyUse()
441 if (CB->isBundleOperand(U)) in surveyUse()
448 unsigned ArgNo = CB->getArgOperandNo(U); in surveyUse()
454 assert(CB->getArgOperand(ArgNo) == CB->getOperand(U->getOperandNo()) && in surveyUse()
563 const auto *CB = dyn_cast<CallBase>(U.getUser()); in surveyFunction() local
564 if (!CB || !CB->isCallee(&U) || in surveyFunction()
565 CB->getFunctionType() != F.getFunctionType()) { in surveyFunction()
572 if (CB->isMustTailCall()) in surveyFunction()
583 for (const Use &UU : CB->uses()) { in surveyFunction()
885 CallBase &CB = cast<CallBase>(*F->user_back()); in removeDeadStuffFromFunction() local
888 const AttributeList &CallPAL = CB.getAttributes(); in removeDeadStuffFromFunction()
898 auto *I = CB.arg_begin(); in removeDeadStuffFromFunction()
923 for (auto *E = CB.arg_end(); I != E; ++I, ++Pi) { in removeDeadStuffFromFunction()
940 CB.getOperandBundlesAsDefs(OpBundles); in removeDeadStuffFromFunction()
943 if (InvokeInst *II = dyn_cast<InvokeInst>(&CB)) { in removeDeadStuffFromFunction()
945 Args, OpBundles, "", CB.getParent()); in removeDeadStuffFromFunction()
947 NewCB = CallInst::Create(NFTy, NF, Args, OpBundles, "", CB.getIterator()); in removeDeadStuffFromFunction()
949 cast<CallInst>(&CB)->getTailCallKind()); in removeDeadStuffFromFunction()
951 NewCB->setCallingConv(CB.getCallingConv()); in removeDeadStuffFromFunction()
953 NewCB->copyMetadata(CB, {LLVMContext::MD_prof, LLVMContext::MD_dbg}); in removeDeadStuffFromFunction()
957 if (!CB.use_empty() || CB.isUsedByMetadata()) { in removeDeadStuffFromFunction()
958 if (NewCB->getType() == CB.getType()) { in removeDeadStuffFromFunction()
960 CB.replaceAllUsesWith(NewCB); in removeDeadStuffFromFunction()
961 NewCB->takeName(&CB); in removeDeadStuffFromFunction()
965 if (!CB.getType()->isX86_MMXTy()) in removeDeadStuffFromFunction()
966 CB.replaceAllUsesWith(PoisonValue::get(CB.getType())); in removeDeadStuffFromFunction()
971 Instruction *InsertPt = &CB; in removeDeadStuffFromFunction()
972 if (InvokeInst *II = dyn_cast<InvokeInst>(&CB)) { in removeDeadStuffFromFunction()
1000 CB.replaceAllUsesWith(RetVal); in removeDeadStuffFromFunction()
1001 NewCB->takeName(&CB); in removeDeadStuffFromFunction()
1007 CB.eraseFromParent(); in removeDeadStuffFromFunction()
1108 if (const auto *CB = dyn_cast<CallBase>(U)) in propagateVirtMustcallLiveness() local
1109 if (CB->isMustTailCall()) in propagateVirtMustcallLiveness()
1110 if (!LiveFunctions.count(CB->getParent()->getParent())) in propagateVirtMustcallLiveness()
1111 Temp.insert(CB->getParent()->getParent()); in propagateVirtMustcallLiveness()