[LLVMdev] Why would one use SExt vs CreateIntCast

Victor Campos vhscampos at gmail.com
Fri Apr 17 17:46:13 PDT 2015


CreateIntCast is just a helper function that creates the correct
instruction (SExt, ZExt or Trunc) depending on the number of bits you
passed as source and as destination.

So yes, they do the same thing, but the API from IRBuilder just makes
things easier.

2015-04-17 21:37 GMT-03:00 Dave Pitsbawn <dpitsbawn at gmail.com>:

> I'm seeing many APIs which seemingly do the same thing, but they seem to
> go through slightly different code paths.
>
> When I think of integer casts I think sign extension, zero extension or
> truncation. But there seems to be a IntCast ... which does the same thing?
>
> Why does CreateIntCast API exist (same for FP methods as well)?
>
> _______________________________________________
> 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/20150417/25af9e47/attachment.html>


More information about the llvm-dev mailing list