Limit DenseMap::setNumEntries input to 1<<31, in accordance with the 31 bits allocated to NumEntries.

std::numeric_limits<int>::max() may be something else than 1<<31.

llvm-svn: 278602
This commit is contained in:
Yaron Keren 2016-08-13 19:46:31 +00:00
parent 7079efe1ce
commit 782788b7a1
1 changed files with 2 additions and 2 deletions

View 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;
}