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:
parent
8995eae095
commit
f570f023cf
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user