[lld] [lld][WebAssembly] Remove vestigial ImportKey::State after DenseMapInfo cleanup (PR #202082)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 6 12:58:41 PDT 2026


https://github.com/MaskRay created https://github.com/llvm/llvm-project/pull/202082

Unused after #201989 removed getEmptyKey()

>From d3b3bda1605b0b085303f56b0c116b89c74baa10 Mon Sep 17 00:00:00 2001
From: Fangrui Song <i at maskray.me>
Date: Sat, 6 Jun 2026 12:12:34 -0700
Subject: [PATCH] [lld][WebAssembly] Remove vestigial ImportKey::State after
 DenseMapInfo cleanup

Unused after #201989 removed getEmptyKey()
---
 lld/wasm/SyntheticSections.h | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/lld/wasm/SyntheticSections.h b/lld/wasm/SyntheticSections.h
index 493ef95a165e5..e0bd91a739026 100644
--- a/lld/wasm/SyntheticSections.h
+++ b/lld/wasm/SyntheticSections.h
@@ -101,27 +101,21 @@ class TypeSection : public SyntheticSection {
  * Used when de-duplicating imports.
  */
 template <typename T> struct ImportKey {
-public:
-  enum class State { Plain, Empty };
-
 public:
   T type;
   std::optional<StringRef> importModule;
   std::optional<StringRef> importName;
-  State state;
 
 public:
-  ImportKey(T type) : type(type), state(State::Plain) {}
-  ImportKey(T type, State state) : type(type), state(state) {}
+  ImportKey(T type) : type(type) {}
   ImportKey(T type, std::optional<StringRef> importModule,
             std::optional<StringRef> importName)
-      : type(type), importModule(importModule), importName(importName),
-        state(State::Plain) {}
+      : type(type), importModule(importModule), importName(importName) {}
 };
 
 template <typename T>
 inline bool operator==(const ImportKey<T> &lhs, const ImportKey<T> &rhs) {
-  return lhs.state == rhs.state && lhs.importModule == rhs.importModule &&
+  return lhs.importModule == rhs.importModule &&
          lhs.importName == rhs.importName && lhs.type == rhs.type;
 }
 
@@ -135,7 +129,6 @@ template <typename T> struct DenseMapInfo<lld::wasm::ImportKey<T>> {
     uintptr_t hash = hash_value(key.importModule);
     hash = hash_combine(hash, key.importName);
     hash = hash_combine(hash, llvm::DenseMapInfo<T>::getHashValue(key.type));
-    hash = hash_combine(hash, key.state);
     return hash;
   }
   static bool isEqual(const lld::wasm::ImportKey<T> &lhs,



More information about the llvm-commits mailing list