[LLVMdev] dyn_cast<Instruction *> returns NULL where it should return a valid instruction
Chuck Zhao
czhao at eecg.toronto.edu
Mon May 16 07:35:32 PDT 2011
I have the following prototype for a function:
void bkp_memory(char *, int);
Inside my LLVM IR, I have a callsite looks like the following:
tail call void @bkp_memory(i8* bitcast (i32** @P to i8*), i32 4) nounwind
When I try to obtain its 1st argument and check whether it is a valid
instruction, using:
Instruction *Inst = dyn_cast<Instruction *>(I->getOperand(0));
it gives me a NULL Ptr, which is quite a surprise to me.
Am I doing anything wrong here?
Note that in many other cases, the bkp_memory() callsite won't have the
embedded form. They look like:
store i32* %21, i32** @P, align 4
%22 = bitcast i32* %21 to i8*
tail call void @bkp_memory(i8* %22, i32 4) nounwind
And the dyn_cast<> conversion is fine in these cases.
Would that be the problem?
Thank you
Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110516/2f1e1f0e/attachment.html>
More information about the llvm-dev
mailing list