[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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284872 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Justin Lebar 2016-10-21 20:10:51 +00:00
parent 228ec7d254
commit 2a98ad5c2c

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());
}
};