memcpy with zero length is hugely expensive, so avoid it. This speeds up coallescing from 1.17s to 0.88s on siod.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40984 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2007-08-10 07:02:50 +00:00
parent 02cee38647
commit 4f155b4c85

View File

@ -380,7 +380,11 @@ SmallVectorImpl<T>::operator=(const SmallVectorImpl<T> &RHS) {
unsigned CurSize = unsigned(size());
if (CurSize >= RHSSize) {
// Assign common elements.
iterator NewEnd = std::copy(RHS.Begin, RHS.Begin+RHSSize, Begin);
iterator NewEnd;
if (RHSSize)
NewEnd = std::copy(RHS.Begin, RHS.Begin+RHSSize, Begin);
else
NewEnd = Begin;
// Destroy excess elements.
destroy_range(NewEnd, End);