[llvm] r195704 - Fix a self-memcpy which only breaks under Valgrind's memcpy

Chandler Carruth chandlerc at gmail.com
Mon Nov 25 16:44:36 PST 2013


Author: chandlerc
Date: Mon Nov 25 18:44:36 2013
New Revision: 195704

URL: http://llvm.org/viewvc/llvm-project?rev=195704&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/Support/SmallPtrSet.cpp

Modified: llvm/trunk/lib/Support/SmallPtrSet.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/SmallPtrSet.cpp?rev=195704&r1=195703&r2=195704&view=diff
==============================================================================
--- llvm/trunk/lib/Support/SmallPtrSet.cpp (original)
+++ llvm/trunk/lib/Support/SmallPtrSet.cpp Mon Nov 25 18:44:36 2013
@@ -218,6 +218,9 @@ SmallPtrSetImpl::SmallPtrSetImpl(const v
 /// 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");





More information about the llvm-commits mailing list