[llvm-dev] How to remove memcpy

Wolfgang McSneed via llvm-dev llvm-dev at lists.llvm.org
Sat Oct 15 16:20:19 PDT 2016


Also - I tried both -fno-builtin and  -ffreestanding and code with memcpy
was still produced.



Kind Regards,

Wolf

On Sat, Oct 15, 2016 at 6:17 PM, Joerg Sonnenberger via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> On Sat, Oct 15, 2016 at 04:12:15PM -0700, Flamedoge wrote:
> > Even with -ffreestanding LLVM generates memcpy/memset? Does this mean
> some
> > passes do not honor this flag? If you really wanted to prevent libcalls,
> > you could technically translate those memcpy/memset to loops in lowering.
> > Kevin
>
> Yes, LLVM follows the same rules as GCC here:
>
>   GCC requires the freestanding environment provide `memcpy', `memmove',
>   `memset' and `memcmp'.
>
> As I said, target lowering may decide to inline all the llvm.mem*
> intrinsics, but it is typically wasteful to do so. Exceptions are e.g.
> on x86 when optimising for size, since the function call overhead is
> large than the "rep stosb" sequence would be for memset or "rep movsb"
> or memcpy.
>
> Joerg
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161015/e279ca7c/attachment.html>


More information about the llvm-dev mailing list