Skip to content

Commit ce86736

Browse files
committed
Fix DenseMapInfo<AliasKeyTy>::getEmptyKey
The all zero key is not a good empty key because it is a legal value. The all zero key means that we are comparing some value to itself (index zero in the value table), looking at the first SILValue value with no type information (for nullptr type info).
1 parent ab969d1 commit ce86736

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

include/swift/SILAnalysis/AliasAnalysis.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,8 @@ bool isLetPointer(SILValue V);
236236
namespace llvm {
237237
template <> struct llvm::DenseMapInfo<AliasKeyTy> {
238238
static inline AliasKeyTy getEmptyKey() {
239-
return {0, 0, 0, 0, nullptr, nullptr};
239+
auto Allone = std::numeric_limits<size_t>::max();
240+
return {Allone, Allone, 0xffff, 0xffff, nullptr, nullptr};
240241
}
241242
static inline AliasKeyTy getTombstoneKey() {
242243
auto Allone = std::numeric_limits<size_t>::max();

0 commit comments

Comments
 (0)