On Tue, 21 Nov 2023, Jonathan Wakely wrote:
CC Marc Glisse who added the relocation support. He might recall why
we use memmove when all uses are for newly-allocated storage, which
cannot overlap the existing storage.
Going back a bit:
https://gcc.gnu.org/pipermail/gcc-patches/2019-April/520658.html
"I think the call to memmove in __relocate_a_1 could probably be
memcpy (I don't remember why I chose memmove)"
Going back a bit further:
https://gcc.gnu.org/pipermail/gcc-patches/2018-September/505800.html
"I had to add a special case for trivial types, using memmove, to avoid
perf regressions, since relocation takes precedence over the old path that
is specialized to call memmove."
So the reason seems to be because vector already used memmove before my
patch. You can dig further if you want to check why that is ;-)
--
Marc Glisse