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:
Benjamin Kramer 2014-04-26 20:10:49 +00:00
parent 59f626d9d5
commit ccf45ebc24
1 changed files with 3 additions and 3 deletions

View File

@ -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);