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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230866 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer 2015-02-28 20:15:07 +00:00
parent f4cff31d3c
commit ce770dda2c

View File

@ -21,16 +21,16 @@
#define LLVM_ADT_INDEXEDMAP_H #define LLVM_ADT_INDEXEDMAP_H
#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include <cassert> #include <cassert>
#include <functional> #include <functional>
#include <vector>
namespace llvm { namespace llvm {
template <typename T, typename ToIndexT = llvm::identity<unsigned> > template <typename T, typename ToIndexT = llvm::identity<unsigned> >
class IndexedMap { class IndexedMap {
typedef typename ToIndexT::argument_type IndexT; typedef typename ToIndexT::argument_type IndexT;
typedef std::vector<T> StorageT; typedef SmallVector<T, 0> StorageT;
StorageT storage_; StorageT storage_;
T nullVal_; T nullVal_;
ToIndexT toIndex_; ToIndexT toIndex_;