diff --git a/compiler/GHC/StgToCmm/InfoTableProv.hs b/compiler/GHC/StgToCmm/InfoTableProv.hs
index 3375a913d84fd047783271f15de8d07fa56eb0c6..13649becc34e1ec796580823f7762041bd0c34b2 100644
--- a/compiler/GHC/StgToCmm/InfoTableProv.hs
+++ b/compiler/GHC/StgToCmm/InfoTableProv.hs
@@ -6,6 +6,7 @@ import Foreign
 
 #if defined(HAVE_LIBZSTD)
 import Foreign.C.Types
+import Foreign.Marshal.Utils (copyBytes)
 import qualified Data.ByteString.Internal as BSI
 import GHC.IO (unsafePerformIO)
 #endif
@@ -274,7 +275,7 @@ compress clvl (BSI.PS srcForeignPtr off len) = unsafePerformIO $
             (srcPtr `plusPtr` off)
             (fromIntegral len)
             (fromIntegral clvl)
-        BSI.create compressedSize $ \p -> BSI.memcpy p dstPtr compressedSize
+        BSI.create compressedSize $ \p -> copyBytes p dstPtr compressedSize
 
 foreign import ccall unsafe "ZSTD_compress"
     zstd_compress ::