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()
247 CI->replaceAllUsesWith(LowerCTPOP(Context, CI->getArgOperand(0), CI)); in LowerIntrinsicCall()
251 CI->replaceAllUsesWith(LowerBSWAP(Context, CI->getArgOperand(0), CI)); in LowerIntrinsicCall()
255 CI->replaceAllUsesWith(LowerCTLZ(Context, CI->getArgOperand(0), CI)); in LowerIntrinsicCall()
260 Value *Src = CI->getArgOperand(0); in LowerIntrinsicCall()
265 Src = LowerCTPOP(Context, Builder.CreateAnd(NotSrc, SrcM1), CI); in LowerIntrinsicCall()
266 CI->replaceAllUsesWith(Src); in LowerIntrinsicCall()
278 CI->replaceAllUsesWith(Constant::getNullValue(CI->getType())); in LowerIntrinsicCall()
287 CI->replaceAllUsesWith(ConstantInt::get(CI->getType(), 0)); in LowerIntrinsicCall()
294 CI->replaceAllUsesWith( in LowerIntrinsicCall()
295 ConstantPointerNull::get(cast<PointerType>(CI->getType()))); in LowerIntrinsicCall()
300 CI->replaceAllUsesWith( in LowerIntrinsicCall()
301 ConstantPointerNull::get(cast<PointerType>(CI->getType()))); in LowerIntrinsicCall()
312 CI->replaceAllUsesWith(ConstantInt::get(Type::getInt64Ty(Context), 0)); in LowerIntrinsicCall()
322 CI->replaceAllUsesWith(ConstantInt::get(CI->getType(), 1)); in LowerIntrinsicCall()
328 CI->replaceAllUsesWith(CI->getOperand(0)); in LowerIntrinsicCall()
337 Value *Size = Builder.CreateIntCast(CI->getArgOperand(2), IntPtr, in LowerIntrinsicCall()
340 Ops[0] = CI->getArgOperand(0); in LowerIntrinsicCall()
341 Ops[1] = CI->getArgOperand(1); in LowerIntrinsicCall()
343 ReplaceCallWith("memcpy", CI, Ops, Ops+3, CI->getArgOperand(0)->getType()); in LowerIntrinsicCall()
348 Value *Size = Builder.CreateIntCast(CI->getArgOperand(2), IntPtr, in LowerIntrinsicCall()
351 Ops[0] = CI->getArgOperand(0); in LowerIntrinsicCall()
352 Ops[1] = CI->getArgOperand(1); in LowerIntrinsicCall()
354 ReplaceCallWith("memmove", CI, Ops, Ops+3, CI->getArgOperand(0)->getType()); in LowerIntrinsicCall()
358 Value *Op0 = CI->getArgOperand(0); in LowerIntrinsicCall()
360 Value *Size = Builder.CreateIntCast(CI->getArgOperand(2), IntPtr, in LowerIntrinsicCall()
365 Ops[1] = Builder.CreateIntCast(CI->getArgOperand(1), in LowerIntrinsicCall()
369 ReplaceCallWith("memset", CI, Ops, Ops+3, CI->getArgOperand(0)->getType()); in LowerIntrinsicCall()
373 ReplaceFPIntrinsicWithCall(CI, "sqrtf", "sqrt", "sqrtl"); in LowerIntrinsicCall()
377 ReplaceFPIntrinsicWithCall(CI, "logf", "log", "logl"); in LowerIntrinsicCall()
381 ReplaceFPIntrinsicWithCall(CI, "log2f", "log2", "log2l"); in LowerIntrinsicCall()
385 ReplaceFPIntrinsicWithCall(CI, "log10f", "log10", "log10l"); in LowerIntrinsicCall()
389 ReplaceFPIntrinsicWithCall(CI, "expf", "exp", "expl"); in LowerIntrinsicCall()
393 ReplaceFPIntrinsicWithCall(CI, "exp2f", "exp2", "exp2l"); in LowerIntrinsicCall()
397 ReplaceFPIntrinsicWithCall(CI, "powf", "pow", "powl"); in LowerIntrinsicCall()
401 ReplaceFPIntrinsicWithCall(CI, "sinf", "sin", "sinl"); in LowerIntrinsicCall()
405 ReplaceFPIntrinsicWithCall(CI, "cosf", "cos", "cosl"); in LowerIntrinsicCall()
409 ReplaceFPIntrinsicWithCall(CI, "floorf", "floor", "floorl"); in LowerIntrinsicCall()
413 ReplaceFPIntrinsicWithCall(CI, "ceilf", "ceil", "ceill"); in LowerIntrinsicCall()
417 ReplaceFPIntrinsicWithCall(CI, "truncf", "trunc", "truncl"); in LowerIntrinsicCall()
421 ReplaceFPIntrinsicWithCall(CI, "roundf", "round", "roundl"); in LowerIntrinsicCall()
425 ReplaceFPIntrinsicWithCall(CI, "roundevenf", "roundeven", "roundevenl"); in LowerIntrinsicCall()
429 ReplaceFPIntrinsicWithCall(CI, "copysignf", "copysign", "copysignl"); in LowerIntrinsicCall()
434 if (!CI->getType()->isVoidTy()) in LowerIntrinsicCall()
435 CI->replaceAllUsesWith(ConstantInt::get(CI->getType(), 1)); in LowerIntrinsicCall()
440 CI->replaceAllUsesWith(UndefValue::get(CI->getType())); in LowerIntrinsicCall()
448 assert(CI->use_empty() && in LowerIntrinsicCall()
450 CI->eraseFromParent(); in LowerIntrinsicCall()
453 bool IntrinsicLowering::LowerToByteSwap(CallInst *CI) { in LowerToByteSwap() argument
455 if (CI->getNumArgOperands() != 1 || in LowerToByteSwap()
456 CI->getType() != CI->getArgOperand(0)->getType() || in LowerToByteSwap()
457 !CI->getType()->isIntegerTy()) in LowerToByteSwap()
460 IntegerType *Ty = dyn_cast<IntegerType>(CI->getType()); in LowerToByteSwap()
465 Module *M = CI->getModule(); in LowerToByteSwap()
468 Value *Op = CI->getArgOperand(0); in LowerToByteSwap()
469 Op = CallInst::Create(Int, Op, CI->getName(), CI); in LowerToByteSwap()
471 CI->replaceAllUsesWith(Op); in LowerToByteSwap()
472 CI->eraseFromParent(); in LowerToByteSwap()