Lines Matching full:ci
30 static CallInst *ReplaceCallWith(const char *NewFn, CallInst *CI, in ReplaceCallWith() argument
35 Module *M = CI->getModule(); in ReplaceCallWith()
43 IRBuilder<> Builder(CI->getParent(), CI->getIterator()); in ReplaceCallWith()
46 NewCI->setName(CI->getName()); in ReplaceCallWith()
47 if (!CI->use_empty()) in ReplaceCallWith()
48 CI->replaceAllUsesWith(NewCI); in ReplaceCallWith()
202 static void ReplaceFPIntrinsicWithCall(CallInst *CI, const char *Fname, in ReplaceFPIntrinsicWithCall() argument
205 switch (CI->getArgOperand(0)->getType()->getTypeID()) { in ReplaceFPIntrinsicWithCall()
208 ReplaceCallWith(Fname, CI, CI->arg_begin(), CI->arg_end(), in ReplaceFPIntrinsicWithCall()
209 Type::getFloatTy(CI->getContext())); in ReplaceFPIntrinsicWithCall()
212 ReplaceCallWith(Dname, CI, CI->arg_begin(), CI->arg_end(), in ReplaceFPIntrinsicWithCall()
213 Type::getDoubleTy(CI->getContext())); in ReplaceFPIntrinsicWithCall()
218 ReplaceCallWith(LDname, CI, CI->arg_begin(), CI->arg_end(), in ReplaceFPIntrinsicWithCall()
219 CI->getArgOperand(0)->getType()); in ReplaceFPIntrinsicWithCall()
224 void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) { in LowerIntrinsicCall() argument
225 IRBuilder<> Builder(CI); in LowerIntrinsicCall()
226 LLVMContext &Context = CI->getContext(); in LowerIntrinsicCall()
228 const Function *Callee = CI->getCalledFunction(); in LowerIntrinsicCall()
241 Value *V = CI->getArgOperand(0); in LowerIntrinsicCall()
242 CI->replaceAllUsesWith(V); in LowerIntrinsicCall()
248 CI->replaceAllUsesWith(ConstantInt::getTrue(CI->getType())); in LowerIntrinsicCall()
252 CI->replaceAllUsesWith(LowerCTPOP(Context, CI->getArgOperand(0), CI)); in LowerIntrinsicCall()
256 CI->replaceAllUsesWith(LowerBSWAP(Context, CI->getArgOperand(0), CI)); in LowerIntrinsicCall()
260 CI->replaceAllUsesWith(LowerCTLZ(Context, CI->getArgOperand(0), CI)); in LowerIntrinsicCall()
265 Value *Src = CI->getArgOperand(0); in LowerIntrinsicCall()
270 Src = LowerCTPOP(Context, Builder.CreateAnd(NotSrc, SrcM1), CI); in LowerIntrinsicCall()
271 CI->replaceAllUsesWith(Src); in LowerIntrinsicCall()
283 CI->replaceAllUsesWith(Constant::getNullValue(CI->getType())); in LowerIntrinsicCall()
292 CI->replaceAllUsesWith(ConstantInt::get(CI->getType(), 0)); in LowerIntrinsicCall()
299 CI->replaceAllUsesWith( in LowerIntrinsicCall()
300 ConstantPointerNull::get(cast<PointerType>(CI->getType()))); in LowerIntrinsicCall()
305 CI->replaceAllUsesWith( in LowerIntrinsicCall()
306 ConstantPointerNull::get(cast<PointerType>(CI->getType()))); in LowerIntrinsicCall()
317 CI->replaceAllUsesWith(ConstantInt::get(Type::getInt64Ty(Context), 0)); in LowerIntrinsicCall()
323 CI->replaceAllUsesWith(ConstantInt::get(Type::getInt64Ty(Context), 0)); in LowerIntrinsicCall()
333 CI->replaceAllUsesWith(ConstantInt::get(CI->getType(), 1)); in LowerIntrinsicCall()
339 CI->replaceAllUsesWith(CI->getOperand(0)); in LowerIntrinsicCall()
349 Value *Size = Builder.CreateIntCast(CI->getArgOperand(2), IntPtr, in LowerIntrinsicCall()
352 Ops[0] = CI->getArgOperand(0); in LowerIntrinsicCall()
353 Ops[1] = CI->getArgOperand(1); in LowerIntrinsicCall()
355 ReplaceCallWith("memcpy", CI, Ops, Ops+3, CI->getArgOperand(0)->getType()); in LowerIntrinsicCall()
360 Value *Size = Builder.CreateIntCast(CI->getArgOperand(2), IntPtr, in LowerIntrinsicCall()
363 Ops[0] = CI->getArgOperand(0); in LowerIntrinsicCall()
364 Ops[1] = CI->getArgOperand(1); in LowerIntrinsicCall()
366 ReplaceCallWith("memmove", CI, Ops, Ops+3, CI->getArgOperand(0)->getType()); in LowerIntrinsicCall()
370 Value *Op0 = CI->getArgOperand(0); in LowerIntrinsicCall()
372 Value *Size = Builder.CreateIntCast(CI->getArgOperand(2), IntPtr, in LowerIntrinsicCall()
377 Ops[1] = Builder.CreateIntCast(CI->getArgOperand(1), in LowerIntrinsicCall()
381 ReplaceCallWith("memset", CI, Ops, Ops+3, CI->getArgOperand(0)->getType()); in LowerIntrinsicCall()
385 ReplaceFPIntrinsicWithCall(CI, "sqrtf", "sqrt", "sqrtl"); in LowerIntrinsicCall()
389 ReplaceFPIntrinsicWithCall(CI, "logf", "log", "logl"); in LowerIntrinsicCall()
393 ReplaceFPIntrinsicWithCall(CI, "log2f", "log2", "log2l"); in LowerIntrinsicCall()
397 ReplaceFPIntrinsicWithCall(CI, "log10f", "log10", "log10l"); in LowerIntrinsicCall()
401 ReplaceFPIntrinsicWithCall(CI, "expf", "exp", "expl"); in LowerIntrinsicCall()
405 ReplaceFPIntrinsicWithCall(CI, "exp2f", "exp2", "exp2l"); in LowerIntrinsicCall()
409 ReplaceFPIntrinsicWithCall(CI, "powf", "pow", "powl"); in LowerIntrinsicCall()
413 ReplaceFPIntrinsicWithCall(CI, "sinf", "sin", "sinl"); in LowerIntrinsicCall()
417 ReplaceFPIntrinsicWithCall(CI, "cosf", "cos", "cosl"); in LowerIntrinsicCall()
421 ReplaceFPIntrinsicWithCall(CI, "floorf", "floor", "floorl"); in LowerIntrinsicCall()
425 ReplaceFPIntrinsicWithCall(CI, "ceilf", "ceil", "ceill"); in LowerIntrinsicCall()
429 ReplaceFPIntrinsicWithCall(CI, "truncf", "trunc", "truncl"); in LowerIntrinsicCall()
433 ReplaceFPIntrinsicWithCall(CI, "roundf", "round", "roundl"); in LowerIntrinsicCall()
437 ReplaceFPIntrinsicWithCall(CI, "roundevenf", "roundeven", "roundevenl"); in LowerIntrinsicCall()
441 ReplaceFPIntrinsicWithCall(CI, "copysignf", "copysign", "copysignl"); in LowerIntrinsicCall()
446 if (!CI->getType()->isVoidTy()) in LowerIntrinsicCall()
447 CI->replaceAllUsesWith(ConstantInt::get(CI->getType(), 1)); in LowerIntrinsicCall()
452 CI->replaceAllUsesWith(UndefValue::get(CI->getType())); in LowerIntrinsicCall()
460 assert(CI->use_empty() && in LowerIntrinsicCall()
462 CI->eraseFromParent(); in LowerIntrinsicCall()
465 bool IntrinsicLowering::LowerToByteSwap(CallInst *CI) { in LowerToByteSwap() argument
467 if (CI->arg_size() != 1 || CI->getType() != CI->getArgOperand(0)->getType() || in LowerToByteSwap()
468 !CI->getType()->isIntegerTy()) in LowerToByteSwap()
471 IntegerType *Ty = dyn_cast<IntegerType>(CI->getType()); in LowerToByteSwap()
476 Module *M = CI->getModule(); in LowerToByteSwap()
479 Value *Op = CI->getArgOperand(0); in LowerToByteSwap()
480 Op = CallInst::Create(Int, Op, CI->getName(), CI->getIterator()); in LowerToByteSwap()
482 CI->replaceAllUsesWith(Op); in LowerToByteSwap()
483 CI->eraseFromParent(); in LowerToByteSwap()