[lld] [lld-macho] Replace unordered_{map, set} with Dense{Map, Set} (PR #202100)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 7 11:16:36 PDT 2026


================
@@ -621,15 +618,10 @@ class WordLiteralSection final : public SyntheticSection {
 private:
   std::vector<WordLiteralInputSection *> inputs;
 
-  template <class T> struct Hasher {
-    llvm::hash_code operator()(T v) const { return llvm::hash_value(v); }
-  };
-  // We're using unordered_map instead of DenseMap here because we need to
-  // support all possible integer values -- there are no suitable tombstone
-  // values for DenseMap.
-  std::unordered_map<UInt128, uint64_t, Hasher<UInt128>> literal16Map;
-  std::unordered_map<uint64_t, uint64_t> literal8Map;
-  std::unordered_map<uint32_t, uint64_t> literal4Map;
+  // DenseMap supports all possible integer values.
----------------
MaskRay wrote:

Switched to a different one - avoid mentioning DenseMap :)

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


More information about the llvm-commits mailing list