extract a specific element from a vector in LLVM IR

Hello everybody,

I am creating a vector in llvm IR and I am able to insert and extract elements.
However, I want to take a specific index from the vector but I am not able to do that. I found in the doxygen the getIndexOperand(), but I have an error during the compilation.
The code I use is the following:

Instruction *extract = ExtractElementInst::Create(emptyVec, ch, "extract");
b->getInstList().insertAfter(Insert3, extract);

Value *index_val = extract->getIndexOperand();

The error I get is:
error: ‘class llvm::Instruction’ has no member named ‘getIndexOperand’
Value *index_val = extract->getIndexOperand();

I see that I cannot use the getIndexOperand() in an Instruction Type, but only through an ExtractElementInst Type.

Do you have any suggestions to get the elements?

Best Regards,
Vasilis

Use the casting operators documented here to convert your Instruction
to ExtractElementInst:
http://llvm.org/docs/ProgrammersManual.html#the-isa-cast-and-dyn-cast-templates

Amara