I am trying to insert intrinsic cos() function call to LLVM pass. My code in a FunctionPass:
std::vector arg_type;
arg_type.push_back(Type::get
I advice you to use IRBuilder
. It simplifies IR generation inside LLVM pass. In your case you can use it like that:
std::vector<Type *> arg_type;
arg_type.push_back(Type::getFloatTy(getGlobalContext()));
Function *fun = Intrinsic::getDeclaration(F.getParent(), Intrinsic::cos, arg_type);
IRBuilder<> Builder(&I);
Builder.CreateCall(fun, args);