From 694089cc3a51510dc001363c634e1616719aa3d2 Mon Sep 17 00:00:00 2001 From: Martin Kinkelin Date: Tue, 21 Aug 2018 20:55:43 +0200 Subject: [PATCH] ldc.arrayinit: Use C memcpy instead of LLVM intrinsic directly The intrinsic's signature has changed for LLVM 7. ldc.arrayinit is the only druntime/Phobos module using it, so just use the C function (or let LLVM optimize it) to keep the adaptations minimal. --- src/ldc/arrayinit.d | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ldc/arrayinit.d b/src/ldc/arrayinit.d index d53f357988..7d7ade532e 100644 --- a/src/ldc/arrayinit.d +++ b/src/ldc/arrayinit.d @@ -5,6 +5,7 @@ private import ldc.intrinsics; extern(C): int memcmp(void*,void*,size_t); +void* memcpy(void*, const(void)*, size_t); size_t strlen(char*); // per-element array init routines @@ -94,7 +95,7 @@ void _d_array_init_mem(void* a, size_t na, void* v, size_t nv) auto p = a; auto end = a + na*nv; while (p !is end) { - llvm_memcpy(p,v,nv,0); + memcpy(p,v,nv); p += nv; } } @@ -146,7 +147,7 @@ void _d_array_slice_copy(void* dst, size_t dstlen, void* src, size_t srclen) if (dstlen != srclen) throw new Exception("lengths don't match for array copy"); else if (dst+dstlen <= src || src+srclen <= dst) - llvm_memcpy!size_t(dst, src, dstlen, 0); + memcpy(dst, src, dstlen); else throw new Exception("overlapping array copy"); }