Lines Matching refs:CI
76 void visitCallInst(CallInst &CI) { checkCandidate(CI); } in visitCallInst() argument
79 for (auto &CI : WorkList) { in perform() local
80 LLVM_DEBUG(dbgs() << "CDCE calls: " << CI->getCalledFunction()->getName() in perform()
82 if (perform(CI)) { in perform()
91 bool perform(CallInst *CI);
92 void checkCandidate(CallInst &CI);
93 void shrinkWrapCI(CallInst *CI, Value *Cond);
94 bool performCallDomainErrorOnly(CallInst *CI, const LibFunc &Func);
95 bool performCallErrors(CallInst *CI, const LibFunc &Func);
96 bool performCallRangeErrorOnly(CallInst *CI, const LibFunc &Func);
97 Value *generateOneRangeCond(CallInst *CI, const LibFunc &Func);
98 Value *generateTwoRangeCond(CallInst *CI, const LibFunc &Func);
99 Value *generateCondForPow(CallInst *CI, const LibFunc &Func);
102 Value *createOrCond(CallInst *CI, CmpInst::Predicate Cmp, float Val, in createOrCond() argument
104 IRBuilder<> BBBuilder(CI); in createOrCond()
105 Value *Arg = CI->getArgOperand(0); in createOrCond()
121 Value *createCond(CallInst *CI, CmpInst::Predicate Cmp, float Val) { in createCond() argument
122 IRBuilder<> BBBuilder(CI); in createCond()
123 Value *Arg = CI->getArgOperand(0); in createCond()
134 bool LibCallsShrinkWrap::performCallDomainErrorOnly(CallInst *CI, in performCallDomainErrorOnly() argument
147 Cond = createOrCond(CI, CmpInst::FCMP_OLT, -1.0f, CmpInst::FCMP_OGT, 1.0f); in performCallDomainErrorOnly()
158 Cond = createOrCond(CI, CmpInst::FCMP_OEQ, INFINITY, CmpInst::FCMP_OEQ, in performCallDomainErrorOnly()
167 Cond = createCond(CI, CmpInst::FCMP_OLT, 1.0f); in performCallDomainErrorOnly()
175 Cond = createCond(CI, CmpInst::FCMP_OLT, 0.0f); in performCallDomainErrorOnly()
181 shrinkWrapCI(CI, Cond); in performCallDomainErrorOnly()
186 bool LibCallsShrinkWrap::performCallRangeErrorOnly(CallInst *CI, in performCallRangeErrorOnly() argument
206 Cond = generateTwoRangeCond(CI, Func); in performCallRangeErrorOnly()
213 Cond = generateOneRangeCond(CI, Func); in performCallRangeErrorOnly()
219 shrinkWrapCI(CI, Cond); in performCallRangeErrorOnly()
224 bool LibCallsShrinkWrap::performCallErrors(CallInst *CI, in performCallErrors() argument
236 Cond = createOrCond(CI, CmpInst::FCMP_OLE, -1.0f, CmpInst::FCMP_OGE, 1.0f); in performCallErrors()
255 Cond = createCond(CI, CmpInst::FCMP_OLE, 0.0f); in performCallErrors()
265 Cond = createCond(CI, CmpInst::FCMP_OLE, -1.0f); in performCallErrors()
273 Cond = generateCondForPow(CI, Func); in performCallErrors()
282 shrinkWrapCI(CI, Cond); in performCallErrors()
288 void LibCallsShrinkWrap::checkCandidate(CallInst &CI) { in checkCandidate() argument
289 if (CI.isNoBuiltin()) in checkCandidate()
295 if (!CI.use_empty()) in checkCandidate()
299 Function *Callee = CI.getCalledFunction(); in checkCandidate()
305 if (CI.arg_empty()) in checkCandidate()
308 Type *ArgType = CI.getArgOperand(0)->getType(); in checkCandidate()
313 WorkList.push_back(&CI); in checkCandidate()
317 Value *LibCallsShrinkWrap::generateOneRangeCond(CallInst *CI, in generateOneRangeCond() argument
335 return createCond(CI, CmpInst::FCMP_OGT, UpperBound); in generateOneRangeCond()
339 Value *LibCallsShrinkWrap::generateTwoRangeCond(CallInst *CI, in generateTwoRangeCond() argument
399 return createOrCond(CI, CmpInst::FCMP_OGT, UpperBound, CmpInst::FCMP_OLT, in generateTwoRangeCond()
418 Value *LibCallsShrinkWrap::generateCondForPow(CallInst *CI, in generateCondForPow() argument
426 Value *Base = CI->getArgOperand(0); in generateCondForPow()
427 Value *Exp = CI->getArgOperand(1); in generateCondForPow()
428 IRBuilder<> BBBuilder(CI); in generateCondForPow()
439 Constant *V = ConstantFP::get(CI->getContext(), APFloat(127.0f)); in generateCondForPow()
467 Constant *V = ConstantFP::get(CI->getContext(), APFloat(UpperV)); in generateCondForPow()
468 Constant *V0 = ConstantFP::get(CI->getContext(), APFloat(0.0f)); in generateCondForPow()
483 void LibCallsShrinkWrap::shrinkWrapCI(CallInst *CI, Value *Cond) { in shrinkWrapCI() argument
486 MDBuilder(CI->getContext()).createBranchWeights(1, 2000); in shrinkWrapCI()
489 SplitBlockAndInsertIfThen(Cond, CI, false, BranchWeights, DT); in shrinkWrapCI()
495 CI->removeFromParent(); in shrinkWrapCI()
496 CallBB->getInstList().insert(CallBB->getFirstInsertionPt(), CI); in shrinkWrapCI()
503 bool LibCallsShrinkWrap::perform(CallInst *CI) { in perform() argument
505 Function *Callee = CI->getCalledFunction(); in perform()
510 if (performCallDomainErrorOnly(CI, Func) || performCallRangeErrorOnly(CI, Func)) in perform()
512 return performCallErrors(CI, Func); in perform()