[libc-commits] [libc] [libc] Change the GPU to use builtin memory functions (PR #68003)

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Tue Oct 3 06:51:09 PDT 2023


jhuber6 wrote:

> Patch LGTM with the following comments:
> 
>     * I don't see `inline_memcmp.h` but it should be modified as well

I actually tried that, but it seemed to cause some bizarre error on AMDGPU. Was planning on leaving it unchanged until I filed a bug and figured out why it crashed.
 
>     * As-is this will probably fail to compile as we define a config wise `-ffreestanding` that in turn triggers `-fno-builtins`. So you probably need to tweak the CMake configuration as well. Maybe we can just revert the `-ffreestanding` for the GPU mem targets? Something like `COMPILE_OPTIONS -fno-freestanding -fno-builtins -fbuiltin=memcpy` for  the GPU version of `memcpy` and so on and so forth.

`-ffreestanding` implies `-fno-builtins` but `-fno-builtins` does not prevent us from using builitin functions. The purpose of `-fno-builtins` is to prevent compiler transformations, for example `-fno-builtin` prevents `memcpy` from becoming `llvm.memcpy`, builtins used by the user are just fine.



https://github.com/llvm/llvm-project/pull/68003


More information about the libc-commits mailing list