[llvm] r278602 - Limit DenseMap::setNumEntries input to 1<<31, in accordance with the 31 bits allocated to NumEntries.
Yaron Keren via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 13 12:46:31 PDT 2016
Author: yrnkrn
Date: Sat Aug 13 14:46:31 2016
New Revision: 278602
URL: http://llvm.org/viewvc/llvm-project?rev=278602&view=rev
Log:
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.
Modified:
llvm/trunk/include/llvm/ADT/DenseMap.h
Modified: llvm/trunk/include/llvm/ADT/DenseMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/DenseMap.h?rev=278602&r1=278601&r2=278602&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/DenseMap.h (original)
+++ llvm/trunk/include/llvm/ADT/DenseMap.h Sat Aug 13 14:46:31 2016
@@ -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;
}
More information about the llvm-commits
mailing list