[LLVMdev] Confusion: dyn_cast for intrinsic function

Jingyue Wu jingyue at google.com
Fri May 23 09:57:25 PDT 2014


IntrinsicInst is a subclass of CallInst, so your code should work just fine
on intrinsics. It would be helpful if you can upload your (reduced) IR.


On Fri, May 23, 2014 at 1:08 AM, 李永超 <lyc364 at gmail.com> wrote:

> 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
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140523/38752133/attachment.html>


More information about the llvm-dev mailing list