projects
/
platform
/
upstream
/
llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c8a5b30
)
[ADT] Mix the bit width into APInt's hash_value
author
Benjamin Kramer
<benny.kra@googlemail.com>
Tue, 14 Apr 2020 16:13:49 +0000
(18:13 +0200)
committer
Benjamin Kramer
<benny.kra@googlemail.com>
Tue, 14 Apr 2020 16:16:15 +0000
(18:16 +0200)
Otherwise all zero values from i1 to i64 collide.
llvm/lib/Support/APInt.cpp
patch
|
blob
|
history
diff --git
a/llvm/lib/Support/APInt.cpp
b/llvm/lib/Support/APInt.cpp
index
faef9a3
..
4a591ef
100644
(file)
--- a/
llvm/lib/Support/APInt.cpp
+++ b/
llvm/lib/Support/APInt.cpp
@@
-548,9
+548,11
@@
unsigned APInt::getBitsNeeded(StringRef str, uint8_t radix) {
hash_code llvm::hash_value(const APInt &Arg) {
if (Arg.isSingleWord())
- return hash_combine(Arg.U.VAL);
+ return hash_combine(Arg.
BitWidth, Arg.
U.VAL);
- return hash_combine_range(Arg.U.pVal, Arg.U.pVal + Arg.getNumWords());
+ return hash_combine(
+ Arg.BitWidth,
+ hash_combine_range(Arg.U.pVal, Arg.U.pVal + Arg.getNumWords()));
}
bool APInt::isSplat(unsigned SplatSizeInBits) const {