[PATCH] D117976: [SmallVector] Optimize move assignment operator for N==0 case

Zhihao Yuan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 23 02:08:20 PST 2022


lichray added inline comments.


================
Comment at: llvm/include/llvm/ADT/SmallVector.h:1213
 
   SmallVector &operator=(const SmallVector &RHS) {
     SmallVectorImpl<T>::operator=(RHS);
----------------
Does the idea apply to the assignment operator?


================
Comment at: llvm/include/llvm/ADT/SmallVector.h:1238
+      } else {
+        if (!this->isSmall())
+          free(this->begin());
----------------
This duplicates some code in `SmallVectorImpl<T>::operator=`, form a smaller function?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117976/new/

https://reviews.llvm.org/D117976



More information about the llvm-commits mailing list