Priyanka Bamne via llvm-dev
2015-Oct-15 08:08 UTC
[llvm-dev] Function return type does not match operand type of return inst!
This is a verifier check.But i am not getting how to resolve this.Do i need to change the function return type or some thing else. ValueToValueMapTy VMap; BasicBlock *clonedBlock =CloneBasicBlock(bb, VMap, ".tr", bb->getParent()); std::cout<<"clone done"<<"\n"; TerminatorInst *merge_term=bb->getTerminator(); std::cout<<"got terminator"<<"\n"; TerminatorInst *new_term=clonedBlock->getTerminator(); errs()<<"new terminator instuction in perf:"<<*new_term<<"\n"; //Perform the ReMapping of Clonedinstructions for (BasicBlock::iterator I = clonedBlock->begin(); I !clonedBlock->end(); ++I) { //Loop over all the operands of the instruction for (unsigned op=0, E = I->getNumOperands(); op != E; ++op) { const Value *Op = I->getOperand(op); //Get it out of the value map Value *V = VMap[Op]; //If not in the value map, then its outside our trace so ignore if(V != 0) I->setOperand(op,V); } } merge_term->setOperand(0,clonedBlock); std::cout<<"set terminator"<<"\n"; this is my pass -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151015/d28a9fc4/attachment.html>
Tim Northover via llvm-dev
2015-Oct-15 16:36 UTC
[llvm-dev] Function return type does not match operand type of return inst!
On 15 October 2015 at 01:08, Priyanka Bamne via llvm-dev <llvm-dev at lists.llvm.org> wrote:> merge_term->setOperand(0,clonedBlock);This seems to be assuming that all basic block terminators will be an unconditional branch. Judging by the error message, you're applying it to one with a ret instead and converting it to "ret label %clonedBB". Cheers. Tim.