summaryrefslogtreecommitdiff
path: root/include/llvm/ADT/PointerIntPair.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-03-29 06:33:22 +0000
committerChris Lattner <sabre@nondot.org>2009-03-29 06:33:22 +0000
commitf341a47d10501bc69b5d4d2217992bb6e08668d8 (patch)
tree6702eb7be774f82108aa5fdfd22acdf9b44d5488 /include/llvm/ADT/PointerIntPair.h
parentba315c1ee7bef78c6824441fe6c1761596ec9880 (diff)
downloadllvm-f341a47d10501bc69b5d4d2217992bb6e08668d8.tar.gz
llvm-f341a47d10501bc69b5d4d2217992bb6e08668d8.tar.bz2
llvm-f341a47d10501bc69b5d4d2217992bb6e08668d8.tar.xz
When forming sentinels for empty/tombstone, make sure to respect the
pointer's expected number of zero low-bits. This should fix the breakage I introduced recently. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67990 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/PointerIntPair.h')
-rw-r--r--include/llvm/ADT/PointerIntPair.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/include/llvm/ADT/PointerIntPair.h b/include/llvm/ADT/PointerIntPair.h
index f189a32858..51a0c77fdc 100644
--- a/include/llvm/ADT/PointerIntPair.h
+++ b/include/llvm/ADT/PointerIntPair.h
@@ -107,11 +107,14 @@ template<typename PointerTy, unsigned IntBits, typename IntType>
struct DenseMapInfo<PointerIntPair<PointerTy, IntBits, IntType> > {
typedef PointerIntPair<PointerTy, IntBits, IntType> Ty;
static Ty getEmptyKey() {
- return Ty(reinterpret_cast<PointerTy>(-1 << IntBits),
- IntType((1 << IntBits)-1));
+ intptr_t Val = -1;
+ Val <<= PointerLikeTypeTraits<PointerTy>::NumLowBitsAvailable;
+ return Ty(reinterpret_cast<PointerTy>(Val), IntType((1 << IntBits)-1));
}
static Ty getTombstoneKey() {
- return Ty(reinterpret_cast<PointerTy>(-2 << IntBits), IntType(0));
+ intptr_t Val = -2;
+ Val <<= PointerLikeTypeTraits<PointerTy>::NumLowBitsAvailable;
+ return Ty(reinterpret_cast<PointerTy>(Val), IntType(0));
}
static unsigned getHashValue(Ty V) {
uintptr_t IV = reinterpret_cast<uintptr_t>(V.getOpaqueValue());