@@ -26,23 +26,16 @@ namespace llvm {
2626template <typename T> struct DenseMapInfo ;
2727
2828class ElementCount {
29- private:
30- // / Prevent code from using initializer-list contructors like
31- // / ElementCount EC = {<unsigned>, <bool>}. The static `get*`
32- // / methods below are preferred, as users should always make a
33- // / conscious choice on the type of `ElementCount` they are
34- // / requesting.
35- ElementCount (unsigned Min, bool Scalable) : Min(Min), Scalable(Scalable) {}
36-
3729public:
38- // / No default constructor. Users should use one of the `get*`
39- // / static methods below, as they should always make a conscious
40- // / choice on the type of `ElementCount` they are requesting.
41- ElementCount () = delete ;
4230 unsigned Min; // Minimum number of vector elements.
4331 bool Scalable; // If true, NumElements is a multiple of 'Min' determined
4432 // at runtime rather than compile time.
4533
34+ ElementCount () = default ;
35+
36+ ElementCount (unsigned Min, bool Scalable)
37+ : Min(Min), Scalable(Scalable) {}
38+
4639 ElementCount operator *(unsigned RHS) {
4740 return { Min * RHS, Scalable };
4841 }
@@ -61,13 +54,7 @@ class ElementCount {
6154 bool operator !=(unsigned RHS) const { return !(*this == RHS); }
6255
6356 ElementCount NextPowerOf2 () const {
64- return {(unsigned )llvm::NextPowerOf2 (Min), Scalable};
65- }
66-
67- static ElementCount getFixed (unsigned Min) { return {Min, false }; }
68- static ElementCount getScalable (unsigned Min) { return {Min, true }; }
69- static ElementCount get (unsigned Min, bool Scalable) {
70- return {Min, Scalable};
57+ return ElementCount (llvm::NextPowerOf2 (Min), Scalable);
7158 }
7259};
7360
@@ -292,12 +279,8 @@ inline TypeSize alignTo(TypeSize Size, uint64_t Align) {
292279}
293280
294281template <> struct DenseMapInfo <ElementCount> {
295- static inline ElementCount getEmptyKey () {
296- return ElementCount::getScalable (~0U );
297- }
298- static inline ElementCount getTombstoneKey () {
299- return ElementCount::getFixed (~0U - 1 );
300- }
282+ static inline ElementCount getEmptyKey () { return {~0U , true }; }
283+ static inline ElementCount getTombstoneKey () { return {~0U - 1 , false }; }
301284 static unsigned getHashValue (const ElementCount& EltCnt) {
302285 if (EltCnt.Scalable )
303286 return (EltCnt.Min * 37U ) - 1U ;
0 commit comments