[PATCH] D56942: Change TPI Bucket size for PDBs from minimum to maximum

C.J. Hebert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 18 14:50:52 PST 2019


CJHebert created this revision.
CJHebert added reviewers: zturner, rnk.

This patch changes the bucket count for the TPI and IPI streams in PDBs generated via LLVM from the minimum value to the maximum value. Changing this value improves symbol lookup for PDBs with large numbers of entries in the TPI and IPI streams.

In the microsoft-pdb repro published to support LLVM implementing PDB support, the provided code initializes the bucket count for the TPI and IPI streams to the maximum size. This occurs in tpi.cpp L33 and tpi.cpp L398. In the LLVM code for generating PDBs, these streams are created with minimum number of buckets. This difference makes LLVM generated PDBs slower for when used for debugging.


Repository:
  rL LLVM

https://reviews.llvm.org/D56942

Files:
  lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp


Index: lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp
===================================================================
--- lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp
+++ lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp
@@ -77,7 +77,7 @@
   H->HashStreamIndex = HashStreamIndex;
   H->HashAuxStreamIndex = kInvalidStreamIndex;
   H->HashKeySize = sizeof(ulittle32_t);
-  H->NumHashBuckets = MinTpiHashBuckets;
+  H->NumHashBuckets = MaxTpiHashBuckets - 1;
 
   // Recall that hash values go into a completely different stream identified by
   // the `HashStreamIndex` field of the `TpiStreamHeader`.  Therefore, the data
@@ -130,7 +130,7 @@
     ulittle32_t *H = Allocator.Allocate<ulittle32_t>(TypeHashes.size());
     MutableArrayRef<ulittle32_t> HashBuffer(H, TypeHashes.size());
     for (uint32_t I = 0; I < TypeHashes.size(); ++I) {
-      HashBuffer[I] = TypeHashes[I] % MinTpiHashBuckets;
+      HashBuffer[I] = TypeHashes[I] % (MaxTpiHashBuckets - 1);
     }
     ArrayRef<uint8_t> Bytes(
         reinterpret_cast<const uint8_t *>(HashBuffer.data()),


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56942.182615.patch
Type: text/x-patch
Size: 1062 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190118/1cf49f4a/attachment.bin>


More information about the llvm-commits mailing list