From b30824e1b97b9d2b4c8e11a5d684bef5b816b887 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Tue, 26 Nov 2013 00:44:36 +0000 Subject: 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 --- lib/Support/SmallPtrSet.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/Support/SmallPtrSet.cpp') 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"); -- cgit v1.2.3