[LLVMdev] Confusion: dyn_cast for intrinsic function

李永超 lyc364 at gmail.com
Fri May 23 01:08:28 PDT 2014


Hi,
   Following is my piece of code:
   
   Instruction * ins = /* something */;
   CallInst * callInst = NULL;
   if(callInst = dyn_cast<CallInst>(ins)) {
           // non-related code omitted
   }


   
   What the code try to do is interpreting LLVM IR and do some operation. 
   dyn_cast returns the expected pointer to CallInst for function calling instruction like strcpy. 
   However, it returns NULL when the instruction calls memset, memcpy or memmove.
   I know LLVM has its own intrinsic for memmove, memset and memcpy, in format like, llvm.memcpy.*.


   My question is: doesn`t dyn_cast works for calling instructions for memmove, memset? Or should I
   invoke some other API in LLVM to obtain a pointer to CallInst type?


Thanks,
Yongchao
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140523/519e83da/attachment.html>


More information about the llvm-dev mailing list