From 2664317b66283e149bd436c14659c283f17bba3a 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. llvm-svn: 195704 --- llvm/lib/Support/SmallPtrSet.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'llvm/lib/Support') diff --git a/llvm/lib/Support/SmallPtrSet.cpp b/llvm/lib/Support/SmallPtrSet.cpp index e37e23b7bb1..fa8d91545e7 100644 --- a/llvm/lib/Support/SmallPtrSet.cpp +++ b/llvm/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