1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 05:01:59 +01:00

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

llvm-svn: 40984
This commit is contained in:
Chris Lattner 2007-08-10 07:02:50 +00:00
parent 8995eae095
commit f570f023cf

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