[libc-commits] [libc] 467b501 - [libc] fix memcpy builtin looping

Michael Jones via libc-commits libc-commits at lists.llvm.org
Thu Dec 16 13:54:40 PST 2021


Author: Michael Jones
Date: 2021-12-16T13:54:35-08:00
New Revision: 467b5017e26571591b618de314ccf7f2fea72c3f

URL: https://github.com/llvm/llvm-project/commit/467b5017e26571591b618de314ccf7f2fea72c3f
DIFF: https://github.com/llvm/llvm-project/commit/467b5017e26571591b618de314ccf7f2fea72c3f.diff

LOG: [libc] fix memcpy builtin looping

previously, memcpy could get stuck in a loop, calling __builtin_memcpy
which would redirect to itself. This patch removes that path.

Reviewed By: gchatelet, sivachandra, lntue

Differential Revision: https://reviews.llvm.org/D115542

Added: 
    

Modified: 
    libc/src/string/memory_utils/elements.h

Removed: 
    


################################################################################
diff  --git a/libc/src/string/memory_utils/elements.h b/libc/src/string/memory_utils/elements.h
index c2b2f007a6c56..b10a744751c33 100644
--- a/libc/src/string/memory_utils/elements.h
+++ b/libc/src/string/memory_utils/elements.h
@@ -511,8 +511,6 @@ template <size_t Size> struct Builtin {
     // __builtin_memcpy_inline guarantees to never call external functions.
     // Unfortunately it is not widely available.
     __builtin_memcpy_inline(dst, src, SIZE);
-#elif __has_builtin(__builtin_memcpy)
-    __builtin_memcpy(dst, src, SIZE);
 #else
     for_loop_copy(dst, src);
 #endif


        


More information about the libc-commits mailing list