Limit DenseMap::setNumEntries input to 1<<31, in accordance with the 31 bits allocate...
authorYaron Keren <yaron.keren@gmail.com>
Sat, 13 Aug 2016 19:46:31 +0000 (19:46 +0000)
committerYaron Keren <yaron.keren@gmail.com>
Sat, 13 Aug 2016 19:46:31 +0000 (19:46 +0000)
std::numeric_limits<int>::max() may be something else than 1<<31.

llvm-svn: 278602

llvm/include/llvm/ADT/DenseMap.h

index a5bcb00..f3910b1 100644 (file)
@@ -966,8 +966,8 @@ private:
     return NumEntries;
   }
   void setNumEntries(unsigned Num) {
-    assert(Num < std::numeric_limits<int>::max() &&
-           "Cannot support more than std::numeric_limits<int>::max() entries");
+    // NumEntries is hardcoded to be 31 bits wide.
+    assert(Num < (1U << 31) && "Cannot support more than 1<<31 entries");
     NumEntries = Num;
   }