summaryrefslogtreecommitdiff
path: root/lib/Support/SmallPtrSet.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2013-11-26 00:44:36 +0000
committerChandler Carruth <chandlerc@gmail.com>2013-11-26 00:44:36 +0000
commitb30824e1b97b9d2b4c8e11a5d684bef5b816b887 (patch)
tree20724b4f0c24708a53b9ab2b026b55e74ba70634 /lib/Support/SmallPtrSet.cpp
parent8037485f166c333d82a1174d70121af0f488bce5 (diff)
downloadllvm-b30824e1b97b9d2b4c8e11a5d684bef5b816b887.tar.gz
llvm-b30824e1b97b9d2b4c8e11a5d684bef5b816b887.tar.bz2
llvm-b30824e1b97b9d2b4c8e11a5d684bef5b816b887.tar.xz
Fix a self-memcpy which only breaks under Valgrind's memcpy
implementation. Silliness, but it'll be a trivial performance optimization. This should clear up a failure on the vg_leak bot. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195704 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/SmallPtrSet.cpp')
-rw-r--r--lib/Support/SmallPtrSet.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Support/SmallPtrSet.cpp b/lib/Support/SmallPtrSet.cpp
index e37e23b7bb..fa8d91545e 100644
--- a/lib/Support/SmallPtrSet.cpp
+++ b/lib/Support/SmallPtrSet.cpp
@@ -218,6 +218,9 @@ SmallPtrSetImpl::SmallPtrSetImpl(const void **SmallStorage, unsigned SmallSize,
/// CopyFrom - implement operator= from a smallptrset that has the same pointer
/// type, but may have a different small size.
void SmallPtrSetImpl::CopyFrom(const SmallPtrSetImpl &RHS) {
+ if (&RHS == this)
+ return;
+
if (isSmall() && RHS.isSmall())
assert(CurArraySize == RHS.CurArraySize &&
"Cannot assign sets with different small sizes");