Assertion `InReg && "Value not in map!"' failed

Ah! I get it now. Thanks a lot !
I changed it to BitCastInst(AI,VoidPtrTy,"",j);

And now I am getting the following error :(. I have been stuck with this error before also. I know I am missing out something silly. What is the cause of this error and Please let me know how to fix it.

/home/bhavani/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1130: llvm::SDOperand llvm::SelectionDAGLowering::getValue(const llvm::Value*): Assertion `InReg && "Value not in map!"' failed.

I know I am asking lot of questions but I am new to LLVM and am finding it hard to figure things out. Appreciate any help!

Thanks,
Bhavani

bhavani krishnan wrote:

Ah! I get it now. Thanks a lot !
I changed it to BitCastInst(AI,VoidPtrTy,"",j);

And now I am getting the following error :(. I have been stuck with this error before also. I know I am missing out something silly. What is the cause of this error and Please let me know how to fix it.

/home/bhavani/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1130: llvm::SDOperand llvm::SelectionDAGLowering::getValue(const llvm::Value*): Assertion `InReg && "Value not in map!"' failed.

I know I am asking lot of questions but I am new to LLVM and am finding it hard to figure things out. Appreciate any help!

This assertion is late, in the codegen phase. I suspect you're sending the codegen invalid IR. Try running the your code through the verifier.

Nick