[PATCH] D14690: Don't force std::set for SmallSet
Duncan P. N. Exon Smith via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 16 14:28:58 PST 2015
> On 2015-Nov-15, at 17:43, Rafael Ávila de Espíndola via llvm-commits <llvm-commits at lists.llvm.org> wrote:
>
> rafael created this revision.
> rafael added a reviewer: chandlerc.
> rafael added a subscriber: llvm-commits.
> rafael set the repository for this revision to rL LLVM.
> Herald added a reviewer: tstellarAMD.
> Herald added a subscriber: arsenm.
>
> It is a bit surprising that MapVector uses a DenseMap but SetVector uses a std::set.
>
>
> Repository:
> rL LLVM
>
> http://reviews.llvm.org/D14690
>
> Files:
> include/llvm/ADT/SmallSet.h
> lib/Analysis/AliasAnalysisEvaluator.cpp
> lib/CodeGen/AggressiveAntiDepBreaker.h
> lib/CodeGen/SelectionDAG/SelectionDAG.cpp
> lib/ExecutionEngine/Orc/OrcMCJITReplacement.h
> lib/Target/AMDGPU/R600ControlFlowFinalizer.cpp
> lib/Target/X86/X86FrameLowering.cpp
> lib/Transforms/IPO/MergeFunctions.cpp
> utils/TableGen/AsmMatcherEmitter.cpp
> utils/TableGen/FixedLenDecoderEmitter.cpp
>
> <D14690.40241.patch>_______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
Seems reasonable to me.
> Index: include/llvm/ADT/SmallSet.h
> ===================================================================
> --- include/llvm/ADT/SmallSet.h
> +++ include/llvm/ADT/SmallSet.h
> @@ -15,26 +15,26 @@
> #define LLVM_ADT_SMALLSET_H
>
> #include "llvm/ADT/None.h"
> +#include "llvm/ADT/DenseSet.h"
> #include "llvm/ADT/SmallPtrSet.h"
> #include "llvm/ADT/SmallVector.h"
> -#include <set>
>
> namespace llvm {
>
> -/// SmallSet - This maintains a set of unique values, optimizing for the case
> -/// when the set is small (less than N). In this case, the set can be
> -/// maintained with no mallocs. If the set gets large, we expand to using an
> -/// std::set to maintain reasonable lookup times.
> +/// This maintains a set of unique values, optimizing for the case when the set
> +/// is small (less than N). In this case, the set can be maintained with no
> +/// mallocs. If the set gets large, we expand to using another implementation
> +/// to maintain reasonable lookup times.
> ///
> /// Note that this set does not provide a way to iterate over members in the
> /// set.
> -template <typename T, unsigned N, typename C = std::less<T> >
> +template <typename T, unsigned N, typename BigSet = DenseSet<T>>
> class SmallSet {
> /// Use a SmallVector to hold the elements here (even though it will never
> /// reach its 'large' stage) to avoid calling the default ctors of elements
> /// we will never use.
> SmallVector<T, N> Vector;
> - std::set<T, C> Set;
> + BigSet Set;
Does `sizeof(SmallSet<T, 1>)` change with this?
> typedef typename SmallVector<T, N>::const_iterator VIterator;
> typedef typename SmallVector<T, N>::iterator mutable_iterator;
>
>
More information about the llvm-commits
mailing list