Lines Matching refs:CB

177     CallBase *CB = dyn_cast<CallBase>(U);  in deleteDeadVarargs()  local
178 if (!CB) in deleteDeadVarargs()
182 Args.assign(CB->arg_begin(), CB->arg_begin() + NumArgs); in deleteDeadVarargs()
185 AttributeList PAL = CB->getAttributes(); in deleteDeadVarargs()
195 CB->getOperandBundlesAsDefs(OpBundles); in deleteDeadVarargs()
198 if (InvokeInst *II = dyn_cast<InvokeInst>(CB)) { in deleteDeadVarargs()
200 Args, OpBundles, "", CB); in deleteDeadVarargs()
202 NewCB = CallInst::Create(NF, Args, OpBundles, "", CB); in deleteDeadVarargs()
204 cast<CallInst>(CB)->getTailCallKind()); in deleteDeadVarargs()
206 NewCB->setCallingConv(CB->getCallingConv()); in deleteDeadVarargs()
208 NewCB->copyMetadata(*CB, {LLVMContext::MD_prof, LLVMContext::MD_dbg}); in deleteDeadVarargs()
212 if (!CB->use_empty()) in deleteDeadVarargs()
213 CB->replaceAllUsesWith(NewCB); in deleteDeadVarargs()
215 NewCB->takeName(CB); in deleteDeadVarargs()
219 CB->eraseFromParent(); in deleteDeadVarargs()
309 CallBase *CB = dyn_cast<CallBase>(U.getUser()); in removeDeadArgumentsFromCallers() local
310 if (!CB || !CB->isCallee(&U) || in removeDeadArgumentsFromCallers()
311 CB->getFunctionType() != F.getFunctionType()) in removeDeadArgumentsFromCallers()
318 Value *Arg = CB->getArgOperand(ArgNo); in removeDeadArgumentsFromCallers()
319 CB->setArgOperand(ArgNo, PoisonValue::get(Arg->getType())); in removeDeadArgumentsFromCallers()
320 CB->removeParamAttrs(ArgNo, UBImplyingAttributes); in removeDeadArgumentsFromCallers()
430 if (const auto *CB = dyn_cast<CallBase>(V)) { in surveyUse() local
431 const Function *F = CB->getCalledFunction(); in surveyUse()
436 if (CB->isBundleOperand(U)) in surveyUse()
443 unsigned ArgNo = CB->getArgOperandNo(U); in surveyUse()
449 assert(CB->getArgOperand(ArgNo) == CB->getOperand(U->getOperandNo()) && in surveyUse()
550 const auto *CB = dyn_cast<CallBase>(U.getUser()); in surveyFunction() local
551 if (!CB || !CB->isCallee(&U) || in surveyFunction()
552 CB->getFunctionType() != F.getFunctionType()) { in surveyFunction()
559 if (CB->isMustTailCall()) in surveyFunction()
570 for (const Use &UU : CB->uses()) { in surveyFunction()
871 CallBase &CB = cast<CallBase>(*F->user_back()); in removeDeadStuffFromFunction() local
874 const AttributeList &CallPAL = CB.getAttributes(); in removeDeadStuffFromFunction()
884 auto *I = CB.arg_begin(); in removeDeadStuffFromFunction()
909 for (auto *E = CB.arg_end(); I != E; ++I, ++Pi) { in removeDeadStuffFromFunction()
926 CB.getOperandBundlesAsDefs(OpBundles); in removeDeadStuffFromFunction()
929 if (InvokeInst *II = dyn_cast<InvokeInst>(&CB)) { in removeDeadStuffFromFunction()
931 Args, OpBundles, "", CB.getParent()); in removeDeadStuffFromFunction()
933 NewCB = CallInst::Create(NFTy, NF, Args, OpBundles, "", &CB); in removeDeadStuffFromFunction()
935 cast<CallInst>(&CB)->getTailCallKind()); in removeDeadStuffFromFunction()
937 NewCB->setCallingConv(CB.getCallingConv()); in removeDeadStuffFromFunction()
939 NewCB->copyMetadata(CB, {LLVMContext::MD_prof, LLVMContext::MD_dbg}); in removeDeadStuffFromFunction()
943 if (!CB.use_empty() || CB.isUsedByMetadata()) { in removeDeadStuffFromFunction()
944 if (NewCB->getType() == CB.getType()) { in removeDeadStuffFromFunction()
946 CB.replaceAllUsesWith(NewCB); in removeDeadStuffFromFunction()
947 NewCB->takeName(&CB); in removeDeadStuffFromFunction()
951 if (!CB.getType()->isX86_MMXTy()) in removeDeadStuffFromFunction()
952 CB.replaceAllUsesWith(PoisonValue::get(CB.getType())); in removeDeadStuffFromFunction()
957 Instruction *InsertPt = &CB; in removeDeadStuffFromFunction()
958 if (InvokeInst *II = dyn_cast<InvokeInst>(&CB)) { in removeDeadStuffFromFunction()
986 CB.replaceAllUsesWith(RetVal); in removeDeadStuffFromFunction()
987 NewCB->takeName(&CB); in removeDeadStuffFromFunction()
993 CB.eraseFromParent(); in removeDeadStuffFromFunction()