diff --git a/llvm/tools/hpvm/lib/Transforms/GenVISC/GenVISC.cpp b/llvm/tools/hpvm/lib/Transforms/GenVISC/GenVISC.cpp index ccb4afe235e18a939fd9631cca0f1800f2c41335..84180fc8489dc0b7fc523006f8c60a8df6b33b58 100644 --- a/llvm/tools/hpvm/lib/Transforms/GenVISC/GenVISC.cpp +++ b/llvm/tools/hpvm/lib/Transforms/GenVISC/GenVISC.cpp @@ -945,8 +945,13 @@ bool GenVISC::runOnModule(Module &M) { ConstantInt* Op = cast<ConstantInt>(CI->getArgOperand(0)); Value* isStreaming = Op->isZero()? ConstantInt::getFalse(Ctx) : ConstantInt::getTrue(Ctx); - - Value* LaunchArgs[] = {F, CI->getArgOperand(2), isStreaming}; + + auto *ArgTy = dyn_cast<PointerType>(CI->getArgOperand(2)->getType()); + assert(ArgTy && "VISC launch argument should be pointer type."); + Value *Arg = CI->getArgOperand(2); + if(!ArgTy->getElementType()->isIntegerTy(8)) + Arg = BitCastInst::CreatePointerCast(CI->getArgOperand(2), Type::getInt8PtrTy(Ctx), "", CI); + Value* LaunchArgs[] = {F, Arg, isStreaming}; CallInst* LaunchInst = CallInst::Create(LaunchF, ArrayRef<Value*>(LaunchArgs, 3), "graphID", CI);