[PATCH] D151079: [llvm][ADT] Change isEqual for DenseMapInfo<std::variant<...>>

Elliot Goodrich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 3 14:06:36 PDT 2023


IncludeGuardian requested changes to this revision.
IncludeGuardian added inline comments.
This revision now requires changes to proceed.


================
Comment at: llvm/include/llvm/ADT/DenseMapInfo.h:326-329
+    template <typename T, typename U>
+    bool operator()(const T &LHS, const U &RHS) const {
+      return false;
+    }
----------------
As this will be instantiated for each combination of types in our variant, I think the approach taken in https://reviews.llvm.org/D151079 is slightly better for compilation speed, although it is not as simple as this.

I would love to suggest C-style variadic functions to avoid any template instantiation, i.e.

```
    bool operator()(...) const {
      return false;
    }
```

but I don't think the behavior is guaranteed for non-POD user-defined types and some compilers will create a copy.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151079/new/

https://reviews.llvm.org/D151079



More information about the llvm-commits mailing list