<div dir="ltr">Hi,<div><br></div><div>I have following lines in my code, where I need to iterate over the instructions in the function (not BB):</div><div><br></div><div><div>  for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I){</div><div>    Instruction *Inst = I;</div><div>    if (cast<Operator>(Inst) -> getOpcode() == Instruction::GetElementPtr){</div><div>      Value* AddrPointer = cast<Value>(Inst);</div><div>      Value* threadId = Inst -> getOperand(1);</div><div>      unsigned AddrSpace = Inst -> getAddressSpace()</div><div>      DataStructureForTrace.push_back (std:make_tuple(new Value(threadId), AddrSpace, 0, new Value(AddrPointer)));</div><div>    }</div><div>  }</div></div><div><br></div><div>I get following error (there are more, some visible here and some not. for eg, getAddressSpace not being for Instruction class.):</div><div><br></div><div><div>error: cannot convert ‘llvm::inst_iterator {aka llvm::InstIterator<llvm::SymbolTableList<llvm::BasicBlock>, llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::BasicBlock, false, false, void>, false, false>, llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void>, false, false>, llvm::Instruction>}’ to ‘llvm::Instruction*’ in initialization</div><div>     Instruction *Inst = I;</div></div><div><br></div><div>I am not sure about this, as I am following some online code practices.</div><div><br></div><div>Thank you.</div><div><br></div><div>Regards,</div><div>Gurunath</div></div>