Mark the growing path in SmallVector::push_back as cold.
It's vital for performance that the cold path of push_back isn't inlined. llvm-svn: 207331
This commit is contained in:
parent
59f626d9d5
commit
ccf45ebc24
|
@ -223,14 +223,14 @@ protected:
|
|||
|
||||
public:
|
||||
void push_back(const T &Elt) {
|
||||
if (this->EndX >= this->CapacityX)
|
||||
if (LLVM_UNLIKELY(this->EndX >= this->CapacityX))
|
||||
this->grow();
|
||||
::new ((void*) this->end()) T(Elt);
|
||||
this->setEnd(this->end()+1);
|
||||
}
|
||||
|
||||
void push_back(T &&Elt) {
|
||||
if (this->EndX >= this->CapacityX)
|
||||
if (LLVM_UNLIKELY(this->EndX >= this->CapacityX))
|
||||
this->grow();
|
||||
::new ((void*) this->end()) T(::std::move(Elt));
|
||||
this->setEnd(this->end()+1);
|
||||
|
@ -327,7 +327,7 @@ protected:
|
|||
}
|
||||
public:
|
||||
void push_back(const T &Elt) {
|
||||
if (this->EndX >= this->CapacityX)
|
||||
if (LLVM_UNLIKELY(this->EndX >= this->CapacityX))
|
||||
this->grow();
|
||||
memcpy(this->end(), &Elt, sizeof(T));
|
||||
this->setEnd(this->end()+1);
|
||||
|
|
Loading…
Reference in New Issue