[PATCH] D63324: [clang-tidy] Replace memcpy by std::copy
Roman Lebedev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 30 07:16:37 PST 2019
lebedev.ri added a comment.
Thinking about it more, i have some negative reservations about this :/
As it can be seen form https://godbolt.org/z/3BZmCM, it seems any and every(?) alternative C++ algorithm
replacement is a performance pessimization in the general case, because `memcpy` requires/'guarantees'
that there must be no overlap between source and destination ranges,
while there is no such restriction for C++ algorithms (=> they will get optimized into `memmove`).
That is unless optimizer also manages to prove that it is safe to optimize `memmove` into `memcpy` there.
(Extra bloat `if(num != 0) memmove` is also not always good)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63324/new/
https://reviews.llvm.org/D63324
More information about the cfe-commits
mailing list