Lines Matching full:ci

57   void visitCallInst(CallInst &CI) { checkCandidate(CI); }  in visitCallInst()  argument
60 for (auto &CI : WorkList) { in perform() local
61 LLVM_DEBUG(dbgs() << "CDCE calls: " << CI->getCalledFunction()->getName() in perform()
63 if (perform(CI)) { in perform()
72 bool perform(CallInst *CI);
73 void checkCandidate(CallInst &CI);
74 void shrinkWrapCI(CallInst *CI, Value *Cond);
75 bool performCallDomainErrorOnly(CallInst *CI, const LibFunc &Func);
76 bool performCallErrors(CallInst *CI, const LibFunc &Func);
77 bool performCallRangeErrorOnly(CallInst *CI, const LibFunc &Func);
78 Value *generateOneRangeCond(CallInst *CI, const LibFunc &Func);
79 Value *generateTwoRangeCond(CallInst *CI, const LibFunc &Func);
80 Value *generateCondForPow(CallInst *CI, const LibFunc &Func);
83 Value *createOrCond(CallInst *CI, Value *Arg, CmpInst::Predicate Cmp, in createOrCond() argument
86 IRBuilder<> BBBuilder(CI); in createOrCond()
93 Value *createOrCond(CallInst *CI, CmpInst::Predicate Cmp, float Val, in createOrCond() argument
95 Value *Arg = CI->getArgOperand(0); in createOrCond()
96 return createOrCond(CI, Arg, Cmp, Val, Arg, Cmp2, Val2); in createOrCond()
111 Value *createCond(CallInst *CI, Value *Arg, CmpInst::Predicate Cmp, in createCond() argument
113 IRBuilder<> BBBuilder(CI); in createCond()
118 Value *createCond(CallInst *CI, CmpInst::Predicate Cmp, float Val) { in createCond() argument
119 Value *Arg = CI->getArgOperand(0); in createCond()
120 return createCond(CI, Arg, Cmp, Val); in createCond()
130 bool LibCallsShrinkWrap::performCallDomainErrorOnly(CallInst *CI, in performCallDomainErrorOnly() argument
143 Cond = createOrCond(CI, CmpInst::FCMP_OLT, -1.0f, CmpInst::FCMP_OGT, 1.0f); in performCallDomainErrorOnly()
154 Cond = createOrCond(CI, CmpInst::FCMP_OEQ, INFINITY, CmpInst::FCMP_OEQ, in performCallDomainErrorOnly()
163 Cond = createCond(CI, CmpInst::FCMP_OLT, 1.0f); in performCallDomainErrorOnly()
171 Cond = createCond(CI, CmpInst::FCMP_OLT, 0.0f); in performCallDomainErrorOnly()
177 shrinkWrapCI(CI, Cond); in performCallDomainErrorOnly()
182 bool LibCallsShrinkWrap::performCallRangeErrorOnly(CallInst *CI, in performCallRangeErrorOnly() argument
202 Cond = generateTwoRangeCond(CI, Func); in performCallRangeErrorOnly()
209 Cond = generateOneRangeCond(CI, Func); in performCallRangeErrorOnly()
215 shrinkWrapCI(CI, Cond); in performCallRangeErrorOnly()
220 bool LibCallsShrinkWrap::performCallErrors(CallInst *CI, in performCallErrors() argument
232 Cond = createOrCond(CI, CmpInst::FCMP_OLE, -1.0f, CmpInst::FCMP_OGE, 1.0f); in performCallErrors()
251 Cond = createCond(CI, CmpInst::FCMP_OLE, 0.0f); in performCallErrors()
261 Cond = createCond(CI, CmpInst::FCMP_OLE, -1.0f); in performCallErrors()
269 Cond = generateCondForPow(CI, Func); in performCallErrors()
278 shrinkWrapCI(CI, Cond); in performCallErrors()
282 // Checks if CI is a candidate for shrinkwrapping and put it into work list if
284 void LibCallsShrinkWrap::checkCandidate(CallInst &CI) { in checkCandidate() argument
285 if (CI.isNoBuiltin()) in checkCandidate()
291 if (!CI.use_empty()) in checkCandidate()
295 Function *Callee = CI.getCalledFunction(); in checkCandidate()
301 if (CI.arg_empty()) in checkCandidate()
304 Type *ArgType = CI.getArgOperand(0)->getType(); in checkCandidate()
309 WorkList.push_back(&CI); in checkCandidate()
313 Value *LibCallsShrinkWrap::generateOneRangeCond(CallInst *CI, in generateOneRangeCond() argument
331 return createCond(CI, CmpInst::FCMP_OGT, UpperBound); in generateOneRangeCond()
335 Value *LibCallsShrinkWrap::generateTwoRangeCond(CallInst *CI, in generateTwoRangeCond() argument
395 return createOrCond(CI, CmpInst::FCMP_OGT, UpperBound, CmpInst::FCMP_OLT, in generateTwoRangeCond()
414 Value *LibCallsShrinkWrap::generateCondForPow(CallInst *CI, in generateCondForPow() argument
422 Value *Base = CI->getArgOperand(0); in generateCondForPow()
423 Value *Exp = CI->getArgOperand(1); in generateCondForPow()
434 return createCond(CI, Exp, CmpInst::FCMP_OGT, 127.0f); in generateCondForPow()
459 return createOrCond(CI, Base, CmpInst::FCMP_OLE, 0.0f, Exp, in generateCondForPow()
467 void LibCallsShrinkWrap::shrinkWrapCI(CallInst *CI, Value *Cond) { in shrinkWrapCI() argument
470 MDBuilder(CI->getContext()).createUnlikelyBranchWeights(); in shrinkWrapCI()
473 SplitBlockAndInsertIfThen(Cond, CI, false, BranchWeights, &DTU); in shrinkWrapCI()
479 CI->removeFromParent(); in shrinkWrapCI()
480 CI->insertInto(CallBB, CallBB->getFirstInsertionPt()); in shrinkWrapCI()
487 bool LibCallsShrinkWrap::perform(CallInst *CI) { in perform() argument
489 Function *Callee = CI->getCalledFunction(); in perform()
494 if (performCallDomainErrorOnly(CI, Func) || performCallRangeErrorOnly(CI, Func)) in perform()
496 return performCallErrors(CI, Func); in perform()