Index: llvm/trunk/include/llvm/ADT/SmallPtrSet.h =================================================================== --- llvm/trunk/include/llvm/ADT/SmallPtrSet.h +++ llvm/trunk/include/llvm/ADT/SmallPtrSet.h @@ -329,6 +329,11 @@ /// SmallPtrSetImplBase for details of the algorithm. template class SmallPtrSet : public SmallPtrSetImpl { + // In small mode SmallPtrSet uses linear search for the elements, so it is + // not a good idea to choose this value too high. You may consider using a + // DenseSet<> instead if you expect many elements in the set. + static_assert(SmallSize <= 32, "SmallSize should be small"); + typedef SmallPtrSetImpl BaseT; // Make sure that SmallSize is a power of two, round up if not. Index: llvm/trunk/include/llvm/ADT/SmallSet.h =================================================================== --- llvm/trunk/include/llvm/ADT/SmallSet.h +++ llvm/trunk/include/llvm/ADT/SmallSet.h @@ -38,6 +38,11 @@ typedef typename SmallVector::const_iterator VIterator; typedef typename SmallVector::iterator mutable_iterator; + // In small mode SmallPtrSet uses linear search for the elements, so it is + // not a good idea to choose this value too high. You may consider using a + // DenseSet<> instead if you expect many elements in the set. + static_assert(N <= 32, "N should be small"); + public: typedef size_t size_type; SmallSet() {} Index: llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp =================================================================== --- llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp +++ llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp @@ -1651,8 +1651,8 @@ // Print type definitions for every type referenced by an instruction and // make a note of any global values or constants that are referenced - SmallPtrSet gvs; - SmallPtrSet consts; + SmallPtrSet gvs; + SmallPtrSet consts; for (Function::const_iterator BB = F->begin(), BE = F->end(); BB != BE; ++BB){ for (BasicBlock::const_iterator I = BB->begin(), E = BB->end();