diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp index 261e9a37ecb55..d44e14a35cac8 100644 --- a/llvm/lib/MC/MCObjectStreamer.cpp +++ b/llvm/lib/MC/MCObjectStreamer.cpp @@ -109,7 +109,9 @@ void MCObjectStreamer::addSpecialFragment(MCFragment *Frag) { void MCObjectStreamer::appendContents(ArrayRef Contents) { ensureHeadroom(Contents.size()); assert(FragSpace >= Contents.size()); - llvm::copy(Contents, getCurFragEnd()); + // As this is performance-sensitive code, explicitly use std::memcpy. + // Optimization of std::copy to memmove is unreliable. + std::memcpy(getCurFragEnd(), Contents.begin(), Contents.size()); CurFrag->FixedSize += Contents.size(); FragSpace -= Contents.size(); }