Lines Matching refs:CS

162 static void createRetBitCast(CallSite CS, Type *RetTy, CastInst **RetBitCast) {  in createRetBitCast()  argument
167 for (User *U : CS.getInstruction()->users()) in createRetBitCast()
173 if (auto *Invoke = dyn_cast<InvokeInst>(CS.getInstruction())) in createRetBitCast()
177 InsertBefore = &*std::next(CS.getInstruction()->getIterator()); in createRetBitCast()
180 auto *Cast = CastInst::CreateBitOrPointerCast(CS.getInstruction(), RetTy, "", in createRetBitCast()
187 U->replaceUsesOfWith(CS.getInstruction(), Cast); in createRetBitCast()
257 static Instruction *versionCallSite(CallSite CS, Value *Callee, in versionCallSite() argument
260 IRBuilder<> Builder(CS.getInstruction()); in versionCallSite()
261 Instruction *OrigInst = CS.getInstruction(); in versionCallSite()
266 if (CS.getCalledValue()->getType() != Callee->getType()) in versionCallSite()
267 Callee = Builder.CreateBitCast(Callee, CS.getCalledValue()->getType()); in versionCallSite()
268 auto *Cond = Builder.CreateICmpEQ(CS.getCalledValue(), Callee); in versionCallSite()
275 SplitBlockAndInsertIfThenElse(Cond, CS.getInstruction(), &ThenTerm, &ElseTerm, in versionCallSite()
320 bool llvm::isLegalToPromote(CallSite CS, Function *Callee, in isLegalToPromote() argument
322 assert(!CS.getCalledFunction() && "Only indirect call sites can be promoted"); in isLegalToPromote()
328 Type *CallRetTy = CS.getInstruction()->getType(); in isLegalToPromote()
342 if (CS.arg_size() != NumParams && !Callee->isVarArg()) { in isLegalToPromote()
353 Type *ActualTy = CS.getArgument(I)->getType(); in isLegalToPromote()
366 Instruction *llvm::promoteCall(CallSite CS, Function *Callee, in promoteCall() argument
368 assert(!CS.getCalledFunction() && "Only indirect call sites can be promoted"); in promoteCall()
371 CS.setCalledFunction(Callee); in promoteCall()
376 CS.getInstruction()->setMetadata(LLVMContext::MD_prof, nullptr); in promoteCall()
377 CS.getInstruction()->setMetadata(LLVMContext::MD_callees, nullptr); in promoteCall()
381 if (CS.getFunctionType() == Callee->getFunctionType()) in promoteCall()
382 return CS.getInstruction(); in promoteCall()
385 Type *CallSiteRetTy = CS.getInstruction()->getType(); in promoteCall()
389 CS.mutateFunctionType(Callee->getFunctionType()); in promoteCall()
398 const AttributeList &CallerPAL = CS.getAttributes(); in promoteCall()
404 auto *Arg = CS.getArgument(ArgNo); in promoteCall()
409 CS.getInstruction()); in promoteCall()
410 CS.setArgument(ArgNo, Cast); in promoteCall()
426 createRetBitCast(CS, CallSiteRetTy, RetBitCast); in promoteCall()
433 CS.setAttributes(AttributeList::get(Ctx, CallerPAL.getFnAttributes(), in promoteCall()
437 return CS.getInstruction(); in promoteCall()
440 Instruction *llvm::promoteCallWithIfThenElse(CallSite CS, Function *Callee, in promoteCallWithIfThenElse() argument
446 Instruction *NewInst = versionCallSite(CS, Callee, BranchWeights); in promoteCallWithIfThenElse()