Lines Matching refs: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()
338 Value *Size = Builder.CreateIntCast(CI->getArgOperand(2), IntPtr, in LowerIntrinsicCall()
341 Ops[0] = CI->getArgOperand(0); in LowerIntrinsicCall()
342 Ops[1] = CI->getArgOperand(1); in LowerIntrinsicCall()
344 ReplaceCallWith("memcpy", CI, Ops, Ops+3, CI->getArgOperand(0)->getType()); 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("memmove", CI, Ops, Ops+3, CI->getArgOperand(0)->getType()); in LowerIntrinsicCall()
359 Value *Op0 = CI->getArgOperand(0); in LowerIntrinsicCall()
361 Value *Size = Builder.CreateIntCast(CI->getArgOperand(2), IntPtr, in LowerIntrinsicCall()
366 Ops[1] = Builder.CreateIntCast(CI->getArgOperand(1), in LowerIntrinsicCall()
370 ReplaceCallWith("memset", CI, Ops, Ops+3, CI->getArgOperand(0)->getType()); in LowerIntrinsicCall()
374 ReplaceFPIntrinsicWithCall(CI, "sqrtf", "sqrt", "sqrtl"); in LowerIntrinsicCall()
378 ReplaceFPIntrinsicWithCall(CI, "logf", "log", "logl"); in LowerIntrinsicCall()
382 ReplaceFPIntrinsicWithCall(CI, "log2f", "log2", "log2l"); in LowerIntrinsicCall()
386 ReplaceFPIntrinsicWithCall(CI, "log10f", "log10", "log10l"); in LowerIntrinsicCall()
390 ReplaceFPIntrinsicWithCall(CI, "expf", "exp", "expl"); in LowerIntrinsicCall()
394 ReplaceFPIntrinsicWithCall(CI, "exp2f", "exp2", "exp2l"); in LowerIntrinsicCall()
398 ReplaceFPIntrinsicWithCall(CI, "powf", "pow", "powl"); in LowerIntrinsicCall()
402 ReplaceFPIntrinsicWithCall(CI, "sinf", "sin", "sinl"); in LowerIntrinsicCall()
406 ReplaceFPIntrinsicWithCall(CI, "cosf", "cos", "cosl"); in LowerIntrinsicCall()
410 ReplaceFPIntrinsicWithCall(CI, "floorf", "floor", "floorl"); in LowerIntrinsicCall()
414 ReplaceFPIntrinsicWithCall(CI, "ceilf", "ceil", "ceill"); in LowerIntrinsicCall()
418 ReplaceFPIntrinsicWithCall(CI, "truncf", "trunc", "truncl"); in LowerIntrinsicCall()
422 ReplaceFPIntrinsicWithCall(CI, "roundf", "round", "roundl"); in LowerIntrinsicCall()
426 ReplaceFPIntrinsicWithCall(CI, "roundevenf", "roundeven", "roundevenl"); in LowerIntrinsicCall()
430 ReplaceFPIntrinsicWithCall(CI, "copysignf", "copysign", "copysignl"); in LowerIntrinsicCall()
435 if (!CI->getType()->isVoidTy()) in LowerIntrinsicCall()
436 CI->replaceAllUsesWith(ConstantInt::get(CI->getType(), 1)); in LowerIntrinsicCall()
441 CI->replaceAllUsesWith(UndefValue::get(CI->getType())); in LowerIntrinsicCall()
449 assert(CI->use_empty() && in LowerIntrinsicCall()
451 CI->eraseFromParent(); in LowerIntrinsicCall()
454 bool IntrinsicLowering::LowerToByteSwap(CallInst *CI) { in LowerToByteSwap() argument
456 if (CI->arg_size() != 1 || 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()