diff --git a/llvm/tools/hpvm/lib/Transforms/GenVISC/GenVISC.cpp b/llvm/tools/hpvm/lib/Transforms/GenVISC/GenVISC.cpp index 43140244ff2593e3180bf5801974c3501c7d380e..cd711b4a7d3d05d9870bfc638aff1a793f7dbcc6 100644 --- a/llvm/tools/hpvm/lib/Transforms/GenVISC/GenVISC.cpp +++ b/llvm/tools/hpvm/lib/Transforms/GenVISC/GenVISC.cpp @@ -1065,6 +1065,7 @@ bool GenVISC::runOnModule(Module &M) { DEBUG(errs() << *EdgeF << "\n"); ConstantInt* Op = cast<ConstantInt>(CI->getArgOperand(5)); ConstantInt* EdgeTypeOp = cast<ConstantInt>(CI->getArgOperand(2)); + assert(Op && EdgeTypeOp && "Arguments of CreateEdge are not constant integers."); Value* isStreaming = Op->isZero()? ConstantInt::getFalse(Ctx) : ConstantInt::getTrue(Ctx); Value* isAllToAll = EdgeTypeOp->isZero()? ConstantInt::getFalse(Ctx) @@ -1086,6 +1087,7 @@ bool GenVISC::runOnModule(Module &M) { DEBUG(errs() << *BindInF << "\n"); // Check if this is a streaming bind or not ConstantInt* Op = cast<ConstantInt>(CI->getArgOperand(3)); + assert(Op && "Streaming argument for bind in intrinsic should be a constant integer."); Value* isStreaming = Op->isZero()? ConstantInt::getFalse(Ctx) : ConstantInt::getTrue(Ctx); Value* BindInArgs[] = {CI->getArgOperand(0), CI->getArgOperand(1), @@ -1104,6 +1106,7 @@ bool GenVISC::runOnModule(Module &M) { DEBUG(errs() << *BindOutF << "\n"); // Check if this is a streaming bind or not ConstantInt* Op = cast<ConstantInt>(CI->getArgOperand(3)); + assert(Op && "Streaming argument for bind out intrinsic should be a constant integer."); Value* isStreaming = Op->isZero()? ConstantInt::getFalse(Ctx) : ConstantInt::getTrue(Ctx); Value* BindOutArgs[] = {CI->getArgOperand(0), CI->getArgOperand(1), @@ -1121,7 +1124,13 @@ bool GenVISC::runOnModule(Module &M) { Function* F = I->getParent()->getParent(); DEBUG(errs() << F->getName() << "\n";); IntrinsicInst* NodeIntrinsic = cast<IntrinsicInst>(CI->getArgOperand(0)); + assert(NodeIntrinsic && "Instruction value in bind out is not a create node intrinsic."); DEBUG(errs() << "Node intrinsic: " << *NodeIntrinsic << "\n"); + assert((NodeIntrinsic->getIntrinsicID() == Intrinsic::visc_createNode || + NodeIntrinsic->getIntrinsicID() == Intrinsic::visc_createNode1D || + NodeIntrinsic->getIntrinsicID() == Intrinsic::visc_createNode2D || + NodeIntrinsic->getIntrinsicID() == Intrinsic::visc_createNode3D) && + "Instruction value in bind out is not a create node intrinsic."); Function* ChildF = cast<Function>(NodeIntrinsic->getArgOperand(0)->stripPointerCasts()); DEBUG(errs() << ChildF->getName() << "\n";); int srcpos = cast<ConstantInt>(CI->getArgOperand(1))->getSExtValue(); @@ -1199,7 +1208,6 @@ bool GenVISC::runOnModule(Module &M) { toBeErased.push_back(CI); ReplaceInstWithInst(oldReturn, RetInst); DEBUG(errs() << "Function after visc return processing\n" << *I->getParent()->getParent() << "\n"); - } if (isVISCCall_getNodeInstanceID_x(I)) {