Lines Matching refs:CI
78 void visitCallInst(CallInst &CI) { checkCandidate(CI); } in visitCallInst() argument
81 for (auto &CI : WorkList) { in perform() local
82 LLVM_DEBUG(dbgs() << "CDCE calls: " << CI->getCalledFunction()->getName() in perform()
84 if (perform(CI)) { in perform()
93 bool perform(CallInst *CI);
94 void checkCandidate(CallInst &CI);
95 void shrinkWrapCI(CallInst *CI, Value *Cond);
96 bool performCallDomainErrorOnly(CallInst *CI, const LibFunc &Func);
97 bool performCallErrors(CallInst *CI, const LibFunc &Func);
98 bool performCallRangeErrorOnly(CallInst *CI, const LibFunc &Func);
99 Value *generateOneRangeCond(CallInst *CI, const LibFunc &Func);
100 Value *generateTwoRangeCond(CallInst *CI, const LibFunc &Func);
101 Value *generateCondForPow(CallInst *CI, const LibFunc &Func);
104 Value *createOrCond(CallInst *CI, CmpInst::Predicate Cmp, float Val, in createOrCond() argument
106 IRBuilder<> BBBuilder(CI); in createOrCond()
107 Value *Arg = CI->getArgOperand(0); in createOrCond()
123 Value *createCond(CallInst *CI, CmpInst::Predicate Cmp, float Val) { in createCond() argument
124 IRBuilder<> BBBuilder(CI); in createCond()
125 Value *Arg = CI->getArgOperand(0); in createCond()
136 bool LibCallsShrinkWrap::performCallDomainErrorOnly(CallInst *CI, in performCallDomainErrorOnly() argument
149 Cond = createOrCond(CI, CmpInst::FCMP_OLT, -1.0f, CmpInst::FCMP_OGT, 1.0f); in performCallDomainErrorOnly()
160 Cond = createOrCond(CI, CmpInst::FCMP_OEQ, INFINITY, CmpInst::FCMP_OEQ, in performCallDomainErrorOnly()
169 Cond = createCond(CI, CmpInst::FCMP_OLT, 1.0f); in performCallDomainErrorOnly()
177 Cond = createCond(CI, CmpInst::FCMP_OLT, 0.0f); in performCallDomainErrorOnly()
183 shrinkWrapCI(CI, Cond); in performCallDomainErrorOnly()
188 bool LibCallsShrinkWrap::performCallRangeErrorOnly(CallInst *CI, in performCallRangeErrorOnly() argument
208 Cond = generateTwoRangeCond(CI, Func); in performCallRangeErrorOnly()
215 Cond = generateOneRangeCond(CI, Func); in performCallRangeErrorOnly()
221 shrinkWrapCI(CI, Cond); in performCallRangeErrorOnly()
226 bool LibCallsShrinkWrap::performCallErrors(CallInst *CI, in performCallErrors() argument
238 Cond = createOrCond(CI, CmpInst::FCMP_OLE, -1.0f, CmpInst::FCMP_OGE, 1.0f); in performCallErrors()
257 Cond = createCond(CI, CmpInst::FCMP_OLE, 0.0f); in performCallErrors()
267 Cond = createCond(CI, CmpInst::FCMP_OLE, -1.0f); in performCallErrors()
275 Cond = generateCondForPow(CI, Func); in performCallErrors()
284 shrinkWrapCI(CI, Cond); in performCallErrors()
290 void LibCallsShrinkWrap::checkCandidate(CallInst &CI) { in checkCandidate() argument
291 if (CI.isNoBuiltin()) in checkCandidate()
297 if (!CI.use_empty()) in checkCandidate()
301 Function *Callee = CI.getCalledFunction(); in checkCandidate()
307 if (CI.getNumArgOperands() == 0) in checkCandidate()
310 Type *ArgType = CI.getArgOperand(0)->getType(); in checkCandidate()
315 WorkList.push_back(&CI); in checkCandidate()
319 Value *LibCallsShrinkWrap::generateOneRangeCond(CallInst *CI, in generateOneRangeCond() argument
337 return createCond(CI, CmpInst::FCMP_OGT, UpperBound); in generateOneRangeCond()
341 Value *LibCallsShrinkWrap::generateTwoRangeCond(CallInst *CI, in generateTwoRangeCond() argument
401 return createOrCond(CI, CmpInst::FCMP_OGT, UpperBound, CmpInst::FCMP_OLT, in generateTwoRangeCond()
420 Value *LibCallsShrinkWrap::generateCondForPow(CallInst *CI, in generateCondForPow() argument
428 Value *Base = CI->getArgOperand(0); in generateCondForPow()
429 Value *Exp = CI->getArgOperand(1); in generateCondForPow()
430 IRBuilder<> BBBuilder(CI); in generateCondForPow()
441 Constant *V = ConstantFP::get(CI->getContext(), APFloat(127.0f)); in generateCondForPow()
469 Constant *V = ConstantFP::get(CI->getContext(), APFloat(UpperV)); in generateCondForPow()
470 Constant *V0 = ConstantFP::get(CI->getContext(), APFloat(0.0f)); in generateCondForPow()
485 void LibCallsShrinkWrap::shrinkWrapCI(CallInst *CI, Value *Cond) { in shrinkWrapCI() argument
488 MDBuilder(CI->getContext()).createBranchWeights(1, 2000); in shrinkWrapCI()
491 SplitBlockAndInsertIfThen(Cond, CI, false, BranchWeights, DT); in shrinkWrapCI()
497 CI->removeFromParent(); in shrinkWrapCI()
498 CallBB->getInstList().insert(CallBB->getFirstInsertionPt(), CI); in shrinkWrapCI()
505 bool LibCallsShrinkWrap::perform(CallInst *CI) { in perform() argument
507 Function *Callee = CI->getCalledFunction(); in perform()
512 if (performCallDomainErrorOnly(CI, Func) || performCallRangeErrorOnly(CI, Func)) in perform()
514 return performCallErrors(CI, Func); in perform()