From: Reid Kleckner Date: Sat, 1 Feb 2020 00:44:07 +0000 (-0800) Subject: Move DenseMapInfo traits to TypeSize.h X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4b606b4af5da3553bf027d456689d2e10b17869b;p=platform%2Fupstream%2Fllvm.git Move DenseMapInfo traits to TypeSize.h Saves 2427 unneeded includes of TypeSize.h, which instantiates std::tie, which instantiates std::tuple, which is slow. I'll remove the tie in a follow-up, since it's just for operator==. --- diff --git a/llvm/include/llvm/ADT/DenseMapInfo.h b/llvm/include/llvm/ADT/DenseMapInfo.h index bd4c60c..48ddbf6 100644 --- a/llvm/include/llvm/ADT/DenseMapInfo.h +++ b/llvm/include/llvm/ADT/DenseMapInfo.h @@ -17,7 +17,6 @@ #include "llvm/ADT/Hashing.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/PointerLikeTypeTraits.h" -#include "llvm/Support/TypeSize.h" #include #include #include @@ -280,21 +279,6 @@ template <> struct DenseMapInfo { static bool isEqual(hash_code LHS, hash_code RHS) { return LHS == RHS; } }; -template <> struct DenseMapInfo { - static inline ElementCount getEmptyKey() { return {~0U, true}; } - static inline ElementCount getTombstoneKey() { return {~0U - 1, false}; } - static unsigned getHashValue(const ElementCount& EltCnt) { - if (EltCnt.Scalable) - return (EltCnt.Min * 37U) - 1U; - - return EltCnt.Min * 37U; - } - - static bool isEqual(const ElementCount& LHS, const ElementCount& RHS) { - return LHS == RHS; - } -}; - } // end namespace llvm #endif // LLVM_ADT_DENSEMAPINFO_H diff --git a/llvm/include/llvm/Support/TypeSize.h b/llvm/include/llvm/Support/TypeSize.h index 7ea651f..459ffb7 100644 --- a/llvm/include/llvm/Support/TypeSize.h +++ b/llvm/include/llvm/Support/TypeSize.h @@ -20,6 +20,8 @@ namespace llvm { +template struct DenseMapInfo; + class ElementCount { public: unsigned Min; // Minimum number of vector elements. @@ -201,6 +203,21 @@ inline TypeSize alignTo(TypeSize Size, uint64_t Align) { Size.isScalable()}; } +template <> struct DenseMapInfo { + static inline ElementCount getEmptyKey() { return {~0U, true}; } + static inline ElementCount getTombstoneKey() { return {~0U - 1, false}; } + static unsigned getHashValue(const ElementCount& EltCnt) { + if (EltCnt.Scalable) + return (EltCnt.Min * 37U) - 1U; + + return EltCnt.Min * 37U; + } + + static bool isEqual(const ElementCount& LHS, const ElementCount& RHS) { + return LHS == RHS; + } +}; + } // end namespace llvm #endif // LLVM_SUPPORT_TypeSize_H