[llvm] [ADT] Avoid map storage for small SmallMapVector (PR #196473)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri May 8 01:17:36 PDT 2026


================
@@ -225,15 +286,67 @@ class MapVector {
   template <class Predicate> void remove_if(Predicate Pred);
 
 private:
+  template <typename LookupKeyT, typename StoredKeyT>
+  [[nodiscard]] static bool keyEqual(const LookupKeyT &LookupKey,
+                                     const StoredKeyT &StoredKey) {
----------------
nikic wrote:

Why do we need this? We don't do this in SmallSetVector.

IMHO weird cases with mismatching DenseMapInfo and operator== should just opt-out by disabling the small-size optimization.

https://github.com/llvm/llvm-project/pull/196473


More information about the llvm-commits mailing list