Lines Matching defs:CB
76 static bool callLooksLikeLoadStore(CallBase *CB, Value *&DataArg,
78 const bool IsStore = CB->getType()->isVoidTy();
82 for (Value *Arg : CB->args()) {
102 DataArg = ConstantInt::get(IntegerType::getInt32Ty(CB->getContext()), 0);
107 unsigned AS = CB->getDataLayout().getAllocaAddrSpace();
109 PointerType *PtrTy = PointerType::get(CB->getContext(), AS);
118 static Value *tryReplaceCallWithLoadStore(Oracle &O, Module &M, CallBase *CB) {
121 if (!callLooksLikeLoadStore(CB, DataArg, PtrArg) || O.shouldKeep())
124 IRBuilder<> B(CB);
127 return B.CreateLoad(CB->getType(), PtrArg, true);
130 static bool callLooksLikeOperator(CallBase *CB,
132 Type *ReturnTy = CB->getType();
136 for (Value *Arg : CB->args()) {
149 static Value *tryReplaceCallWithOperator(Oracle &O, Module &M, CallBase *CB) {
152 if (!callLooksLikeOperator(CB, Arguments) || Arguments.size() > 3)
158 IRBuilder<> B(CB);
159 if (CB->getType()->isFPOrFPVectorTy()) {
166 return B.CreateIntrinsic(Intrinsic::fma, {CB->getType()}, Arguments);
174 if (CB->getType()->isIntOrIntVectorTy()) {
181 return B.CreateIntrinsic(Intrinsic::fshl, {CB->getType()}, Arguments);
226 CallBase *CB = cast<CallBase>(&I);
228 if (Value *NewOp = tryReplaceCallWithOperator(O, M, CB))
231 if (Value *NewOp = tryReplaceCallWithLoadStore(O, M, CB))