[ADT] Compare strings' hashes first before comparing their values.

Summary:
We already have the hashes in hand, and comparing hashes should be much
more discriminatory than comparing the StringRefs' sizes.

Reviewers: rafael

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D25705

llvm-svn: 284872
This commit is contained in:
Justin Lebar 2016-10-21 20:10:51 +00:00
parent d87ea9a1c9
commit c9d66eb05b
1 changed files with 2 additions and 1 deletions

View File

@ -61,7 +61,8 @@ template <> struct DenseMapInfo<CachedHashStringRef> {
}
static bool isEqual(const CachedHashStringRef &LHS,
const CachedHashStringRef &RHS) {
return DenseMapInfo<StringRef>::isEqual(LHS.val(), RHS.val());
return LHS.hash() == RHS.hash() &&
DenseMapInfo<StringRef>::isEqual(LHS.val(), RHS.val());
}
};