[PATCH] D85131: [NFC][APInt][DenseMapInfo] Move DenseMapAPIntKeyInfo into DenseMap.h as DenseMapInfo<APInt>

Kuter Dinel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 3 07:30:44 PDT 2020


kuter added inline comments.


================
Comment at: llvm/include/llvm/ADT/DenseMapInfo.h:352
+/// Provide DenseMapInfo for APInt.
+template <> struct DenseMapInfo<APInt> {
+  static inline APInt getEmptyKey() {
----------------
It seems that,  it is possible to specify arbitrary key info traits for `DenseSet`. 
This was what `DenseMapAPIntKeyInfo` in `LLVMContextImpl.h` was dong.
It would declare a `DenseSet` like this:
`DenseSet<APInt, DenseMapAPIntKeyInfo>`

This specialization   might not be desirable for every use case since `static_cast<unsigned>` discards information. 

Maybe we want to do this in the Attributor like the way `LLVMContextImpl.h` was doing it ?


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

https://reviews.llvm.org/D85131



More information about the llvm-commits mailing list