summaryrefslogtreecommitdiffstats
path: root/llvm/tools
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2017-05-23 18:23:59 +0000
committerReid Kleckner <rnk@google.com>2017-05-23 18:23:59 +0000
commitded38803c5c5885b790b58ad93c4d9e981da8db8 (patch)
treeb045a713db43f8568ab5990e541e6e1ca0004f5e /llvm/tools
parent15288da29331e1ea49ebba445b7c2f694ee7ced3 (diff)
downloadbcm5719-llvm-ded38803c5c5885b790b58ad93c4d9e981da8db8.tar.gz
bcm5719-llvm-ded38803c5c5885b790b58ad93c4d9e981da8db8.zip
[PDB] Hash types up front when merging types instead of using StringMap
Summary: First, StringMap uses llvm::HashString, which is only good for short identifiers and really bad for large blobs of binary data like type records. Moving to `DenseMap<StringRef, TypeIndex>` with some tricks for memory allocation fixes that. Unfortunately, that didn't buy very much performance. Profiling showed that we spend a long time during DenseMap growth rehashing existing entries. Also, in general, DenseMap is faster when the keys are small. This change takes that to the logical conclusion by introducing a small wrapper value type around a pointer to key data. The key data contains a precomputed hash, the original record data (pointer and size), and the type index, which is the "value" of our original map. This reduces the time to produce llvm-as.exe and llvm-as.pdb from ~15s on my machine to 3.5s, which is about a 4x improvement. Reviewers: zturner, inglorion, ruiu Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D33428 llvm-svn: 303665
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp b/llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp
index 6b6a0ef046a..64688559323 100644
--- a/llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp
+++ b/llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp
@@ -877,14 +877,12 @@ static void mergePdbs() {
auto &DestTpi = Builder.getTpiBuilder();
auto &DestIpi = Builder.getIpiBuilder();
- MergedTpi.ForEachRecord(
- [&DestTpi](TypeIndex TI, MutableArrayRef<uint8_t> Data) {
- DestTpi.addTypeRecord(Data, None);
- });
- MergedIpi.ForEachRecord(
- [&DestIpi](TypeIndex TI, MutableArrayRef<uint8_t> Data) {
- DestIpi.addTypeRecord(Data, None);
- });
+ MergedTpi.ForEachRecord([&DestTpi](TypeIndex TI, ArrayRef<uint8_t> Data) {
+ DestTpi.addTypeRecord(Data, None);
+ });
+ MergedIpi.ForEachRecord([&DestIpi](TypeIndex TI, ArrayRef<uint8_t> Data) {
+ DestIpi.addTypeRecord(Data, None);
+ });
SmallString<64> OutFile(opts::merge::PdbOutputFile);
if (OutFile.empty()) {
OpenPOWER on IntegriCloud