template <> struct DenseMapInfo<APInt, void> {
static inline APInt getEmptyKey() {
APInt V(nullptr, 0);
- V.U.VAL = 0;
+ V.U.VAL = ~0ULL;
return V;
}
static inline APInt getTombstoneKey() {
APInt V(nullptr, 0);
- V.U.VAL = 1;
+ V.U.VAL = ~1ULL;
return V;
}
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/Twine.h"
#include "gtest/gtest.h"
EXPECT_EQ(APIntOps::ScaleBitMask(APInt(8, 0xE4), 4, true), APInt(4, 0x08));
}
+TEST(APIntTest, DenseMap) {
+ DenseMap<APInt, int> Map;
+ APInt ZeroWidthInt(0, 0, false);
+ Map.insert({ZeroWidthInt, 0});
+ Map.find(ZeroWidthInt);
+}
+
} // end anonymous namespace