diff --git a/llvm/include/llvm/Transforms/IPO/FunctionImport.h b/llvm/include/llvm/Transforms/IPO/FunctionImport.h index c06d96bbe62e22..78932c12e76ff8 100644 --- a/llvm/include/llvm/Transforms/IPO/FunctionImport.h +++ b/llvm/include/llvm/Transforms/IPO/FunctionImport.h @@ -150,7 +150,24 @@ class FunctionImporter { }; // A map from destination modules to lists of imports. - using ImportListsTy = DenseMap; + class ImportListsTy { + public: + ImportListsTy() = default; + ImportListsTy(size_t Size) : ListsImpl(Size) {} + + ImportMapTy &operator[](StringRef DestMod) { + return ListsImpl.try_emplace(DestMod).first->second; + } + + size_t size() const { return ListsImpl.size(); } + + using const_iterator = DenseMap::const_iterator; + const_iterator begin() const { return ListsImpl.begin(); } + const_iterator end() const { return ListsImpl.end(); } + + private: + DenseMap ListsImpl; + }; /// The set contains an entry for every global value that the module exports. /// Depending on the user context, this container is allowed to contain