[llvm] [DebugNames] Use hashes to quickly filter false positives (PR #79755)
Adrian Prantl via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 29 14:02:21 PST 2024
================
@@ -937,9 +937,11 @@ DWARFDebugNames::ValueIterator::findEntryOffsetInCurrentIndex() {
return std::nullopt; // Empty bucket
for (; Index <= Hdr.NameCount; ++Index) {
- uint32_t Hash = CurrentIndex->getHashArrayEntry(Index);
- if (Hash % Hdr.BucketCount != Bucket)
+ uint32_t HashAtIndex = CurrentIndex->getHashArrayEntry(Index);
+ if (HashAtIndex % Hdr.BucketCount != Bucket)
return std::nullopt; // End of bucket
+ if (HashAtIndex != Hash)
----------------
adrian-prantl wrote:
Maybe add: `// Only do an expensive string comparison if the hashes match.`
https://github.com/llvm/llvm-project/pull/79755
More information about the llvm-commits
mailing list