From: Zachary Turner Date: Thu, 24 Jan 2019 22:25:55 +0000 (+0000) Subject: [PDB] Increase TPI hash bucket count. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=24fa3683a5f44327a758bf80b92e6d41dc8463e5;p=llvm [PDB] Increase TPI hash bucket count. PDBs contain several serialized hash tables. In the microsoft-pdb repo published to support LLVM implementing PDB support, the provided 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. Patch by C.J. Hebert Differential Revision: https://reviews.llvm.org/D56942 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352117 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp b/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp index 36f02e5873f..f2a5dcb93d6 100644 --- a/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp +++ b/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp @@ -76,7 +76,7 @@ Error TpiStreamBuilder::finalize() { 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 @@ -129,7 +129,7 @@ Error TpiStreamBuilder::finalizeMsfLayout() { ulittle32_t *H = Allocator.Allocate(TypeHashes.size()); MutableArrayRef 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 Bytes( reinterpret_cast(HashBuffer.data()), diff --git a/tools/llvm-pdbutil/DumpOutputStyle.cpp b/tools/llvm-pdbutil/DumpOutputStyle.cpp index 89b004320c8..2c3a7b5e666 100644 --- a/tools/llvm-pdbutil/DumpOutputStyle.cpp +++ b/tools/llvm-pdbutil/DumpOutputStyle.cpp @@ -1412,6 +1412,21 @@ Error DumpOutputStyle::dumpTpiStream(uint32_t StreamIdx) { if (DumpExtras) { P.NewLine(); + support::ulittle32_t Version; + + support::ulittle16_t HashStreamIndex; + support::ulittle16_t HashAuxStreamIndex; + support::ulittle32_t HashKeySize; + support::ulittle32_t NumHashBuckets; + + P.formatLine("Header Version: {0}", + static_cast(Stream.getTpiVersion())); + P.formatLine("Hash Stream Index: {0}", Stream.getTypeHashStreamIndex()); + P.formatLine("Aux Hash Stream Index: {0}", + Stream.getTypeHashStreamAuxIndex()); + P.formatLine("Hash Key Size: {0}", Stream.getHashKeySize()); + P.formatLine("Num Hash Buckets: {0}", Stream.getNumHashBuckets()); + auto IndexOffsets = Stream.getTypeIndexOffsets(); P.formatLine("Type Index Offsets:"); for (const auto &IO : IndexOffsets) {