diff --git a/llvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp b/llvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp index 53850c98c2a817b4a2ebdd661887b7da5e9dbde6..9c0476ff52841e16f5c43de35d395e16c3b97aac 100644 --- a/llvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp +++ b/llvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp @@ -1379,6 +1379,7 @@ void CGT_NVPTX::codeGen(DFLeafNode* N) { } case Intrinsic::floor: { + errs() << "Found floor intrinsic\n"; F = Intrinsic::getDeclaration(&KernelM, Intrinsic::nvvm_floor_f); FunctionType* FTy = F->getFunctionType(); DEBUG(errs() << *F << "\n"); @@ -1400,6 +1401,12 @@ void CGT_NVPTX::codeGen(DFLeafNode* N) { } args.push_back(V); } + // Insert call instruction + CallInst* Inst = CallInst::Create(F, args, + F->getReturnType()->isVoidTy()? "" : CI->getName(), CI); + DEBUG(errs() << "\tSubstitute with: " << *Inst << "\n"); + CI->replaceAllUsesWith(Inst); + IItoRemove.push_back(II); break; } default: