[llvm] 65053fb - [NFC] Use more appropriate SmallVectorImpl::append call in std::initializer_list SmallVector constructor
Dawid Jurczak via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 30 01:13:54 PDT 2022
Author: Dawid Jurczak
Date: 2022-07-30T09:17:35+02:00
New Revision: 65053fbc0d461841db176f1143f3cc1d16997df0
URL: https://github.com/llvm/llvm-project/commit/65053fbc0d461841db176f1143f3cc1d16997df0
DIFF: https://github.com/llvm/llvm-project/commit/65053fbc0d461841db176f1143f3cc1d16997df0.diff
LOG: [NFC] Use more appropriate SmallVectorImpl::append call in std::initializer_list SmallVector constructor
Since we are in constructor there is no need to perform redundant call to SmallVectorImpl::clear() inside assign function.
Although calling cheaper append function instead assign doesn't make any difference on optimized builds
(DSE does the job removing stores), we still save some cycles for debug binaries.
Differential Revision: https://reviews.llvm.org/D130361
Added:
Modified:
llvm/include/llvm/ADT/SmallVector.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/SmallVector.h b/llvm/include/llvm/ADT/SmallVector.h
index e34702bdbb3c1..2470d6ff9a190 100644
--- a/llvm/include/llvm/ADT/SmallVector.h
+++ b/llvm/include/llvm/ADT/SmallVector.h
@@ -1212,7 +1212,7 @@ class LLVM_GSL_OWNER SmallVector : public SmallVectorImpl<T>,
}
SmallVector(std::initializer_list<T> IL) : SmallVectorImpl<T>(N) {
- this->assign(IL);
+ this->append(IL);
}
SmallVector(const SmallVector &RHS) : SmallVectorImpl<T>(N) {
More information about the llvm-commits
mailing list