diff --git a/include/llvm/ADT/SmallVector.h b/include/llvm/ADT/SmallVector.h index 791d03c6491..df46f919118 100644 --- a/include/llvm/ADT/SmallVector.h +++ b/include/llvm/ADT/SmallVector.h @@ -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);