[PATCH] D82230: [ADT] Specialize std::swap() for SetVector
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 19 15:14:17 PDT 2020
nikic marked an inline comment as done.
nikic added a comment.
Compile-time numbers:
Original change: https://llvm-compile-time-tracker.com/compare.php?from=db8255aee790a747f3c1fd2dfd647f8ca1d7bc79&to=1eddce4177cfddc86d4696b758904443b0b4f193&stat=instructions
Switch to SmallPtrSet as base: https://llvm-compile-time-tracker.com/compare.php?from=8c61f13a0f7cb4078b3dd4481c89b48fe4a50f77&to=837ca4796065ccd0ac0d20860341ac06a9645009&stat=instructions
This patch: https://llvm-compile-time-tracker.com/compare.php?from=35651fdd4537c081ca47acde58b6fd4b5f6997b3&to=e32a6e0aaed46e024993cc5369418ba01dfedf38&stat=instructions
So this patch recovers about half of the original regression.
================
Comment at: llvm/include/llvm/ADT/SetVector.h:268
+ set_.swap(RHS.set_);
+ vector_.swap(RHS.vector_);
+ }
----------------
Something that I'm really stumped about: I initially used `std::swap()` here instead of the `swap()` member functions. However, for some reason that ends up picking up an optimized swap implementation for `vector_`, but not for `set_` (which is the more important one really).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D82230/new/
https://reviews.llvm.org/D82230
More information about the llvm-commits
mailing list