[llvm] r230866 - IndexedMap: Default to SmallVector<T, 0>
Philip Reames
listmail at philipreames.com
Mon Mar 2 14:12:59 PST 2015
Can you add a comment explaining why this matters? From the code, it's
not clear why the SmallVector<T, 0> trick is needed. (Or what it's
doing for that matter.)
On 02/28/2015 12:15 PM, Benjamin Kramer wrote:
> Author: d0k
> Date: Sat Feb 28 14:15:07 2015
> New Revision: 230866
>
> URL: http://llvm.org/viewvc/llvm-project?rev=230866&view=rev
> Log:
> IndexedMap: Default to SmallVector<T, 0>
>
> This looks ridiculous but SmallVector's realloc tricks really help with
> large vectors of PODs, such as our virtreg IndexedMap.
>
> Modified:
> llvm/trunk/include/llvm/ADT/IndexedMap.h
>
> Modified: llvm/trunk/include/llvm/ADT/IndexedMap.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/IndexedMap.h?rev=230866&r1=230865&r2=230866&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/ADT/IndexedMap.h (original)
> +++ llvm/trunk/include/llvm/ADT/IndexedMap.h Sat Feb 28 14:15:07 2015
> @@ -21,16 +21,16 @@
> #define LLVM_ADT_INDEXEDMAP_H
>
> #include "llvm/ADT/STLExtras.h"
> +#include "llvm/ADT/SmallVector.h"
> #include <cassert>
> #include <functional>
> -#include <vector>
>
> namespace llvm {
>
> template <typename T, typename ToIndexT = llvm::identity<unsigned> >
> class IndexedMap {
> typedef typename ToIndexT::argument_type IndexT;
> - typedef std::vector<T> StorageT;
> + typedef SmallVector<T, 0> StorageT;
> StorageT storage_;
> T nullVal_;
> ToIndexT toIndex_;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list