[libc-commits] [PATCH] D115542: [libc] fix memcpy builtin looping

Guillaume Chatelet via Phabricator via libc-commits libc-commits at lists.llvm.org
Sun Dec 12 02:31:33 PST 2021


gchatelet accepted this revision.
gchatelet added inline comments.


================
Comment at: libc/src/string/memory_utils/elements.h:515
-#elif __has_builtin(__builtin_memcpy)
-    __builtin_memcpy(dst, src, SIZE);
 #else
----------------
sivachandra wrote:
> This should be sufficient to fix the problem.
Yes but I think that the functions embedding `inline_memcpy` via [[ https://github.com/llvm/llvm-project/blob/main/libc/src/string/memory_utils/memcpy_implementations.h | memcpy_implementations.h ]] should still be marked `-fno-builtin-memcpy` overwise clang might still detect the copy for loop as `memcpy` and call it instead of embedding it.

To be safe we should have all string functions marked with `-fno-builtin`. This would prevent the recursive call for all of `memmove`, `memcmp`, `memset`, etc.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115542/new/

https://reviews.llvm.org/D115542



More information about the libc-commits mailing list