[PATCH] D91467: ADT: Take small enough, trivially copyable T by value in SmallVector
Duncan P. N. Exon Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 13 16:45:18 PST 2020
dexonsmith added inline comments.
================
Comment at: llvm/include/llvm/ADT/SmallVector.h:594-598
// If we just moved the element we're inserting, be sure to update
// the reference.
const T *EltPtr = &Elt;
if (I <= EltPtr && EltPtr < this->end())
++EltPtr;
----------------
njames93 wrote:
> This code is redundant if Elt is passed by value, however I don't think all(or any) compilers are smart enough to see that, wrapping this around an if block dependent on whether Elt is passed by ref would in all likelihood be a win. Same goes for the other call to insert below.
Good point; I’ll update on Monday.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D91467/new/
https://reviews.llvm.org/D91467
More information about the llvm-commits
mailing list