[lld] 55b97a6 - [LLD][COFF] Add more type record information to /summary
Alexandre Ganea via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 2 06:54:05 PDT 2020
Author: Alexandre Ganea
Date: 2020-10-02T09:36:11-04:00
New Revision: 55b97a6d2a7459dd5bdc78b199c05525302137c2
URL: https://github.com/llvm/llvm-project/commit/55b97a6d2a7459dd5bdc78b199c05525302137c2
DIFF: https://github.com/llvm/llvm-project/commit/55b97a6d2a7459dd5bdc78b199c05525302137c2.diff
LOG: [LLD][COFF] Add more type record information to /summary
This adds the following two new lines to /summary:
21351 Input OBJ files (expanded from all cmd-line inputs)
61 PDB type server dependencies
38 Precomp OBJ dependencies
1420669231 Input type records <<<<
78665073382 Input type records bytes <<<<
8801393 Merged TPI records
3177158 Merged IPI records
59194 Output PDB strings
71576766 Global symbol records
25416935 Module symbol records
2103431 Public symbol records
Differential Revision: https://reviews.llvm.org/D88703
Added:
Modified:
lld/COFF/DebugTypes.cpp
lld/COFF/DebugTypes.h
lld/COFF/PDB.cpp
lld/test/COFF/pdb-type-server-simple.test
lld/test/COFF/precomp-link.test
lld/test/COFF/precomp-summary-fail.test
Removed:
################################################################################
diff --git a/lld/COFF/DebugTypes.cpp b/lld/COFF/DebugTypes.cpp
index baec05d1e87a..febbd19084da 100644
--- a/lld/COFF/DebugTypes.cpp
+++ b/lld/COFF/DebugTypes.cpp
@@ -332,6 +332,8 @@ Error TpiSource::mergeDebugT(TypeMerger *m) {
ipiMap = indexMapStorage;
if (config->showSummary) {
+ nbTypeRecords = indexMapStorage.size() - nbHeadIndices;
+ nbTypeRecordsBytes = reader.getLength();
// Count how many times we saw each type record in our input. This
// calculation requires a second pass over the type records to classify each
// record as a type or index. This is slow, but this code executes when
@@ -386,6 +388,12 @@ Error TypeServerSource::mergeDebugT(TypeMerger *m) {
}
if (config->showSummary) {
+ nbTypeRecords = tpiMap.size() + ipiMap.size();
+ nbTypeRecordsBytes =
+ expectedTpi->typeArray().getUnderlyingStream().getLength() +
+ (maybeIpi ? maybeIpi->typeArray().getUnderlyingStream().getLength()
+ : 0);
+
// Count how many times we saw each type record in our input. If a
// destination type index is present in the source to destination type index
// map, that means we saw it once in the input. Add it to our histogram.
@@ -693,6 +701,11 @@ void TpiSource::remapTpiWithGHashes(GHashState *g) {
ipiMap = indexMapStorage;
mergeUniqueTypeRecords(file->debugTypes);
// TODO: Free all unneeded ghash resources now that we have a full index map.
+
+ if (config->showSummary) {
+ nbTypeRecords = ghashes.size();
+ nbTypeRecordsBytes = file->debugTypes.size();
+ }
}
// PDBs do not actually store global hashes, so when merging a type server
@@ -759,6 +772,16 @@ void TypeServerSource::remapTpiWithGHashes(GHashState *g) {
ipiSrc->tpiMap = tpiMap;
ipiSrc->ipiMap = ipiMap;
ipiSrc->mergeUniqueTypeRecords(typeArrayToBytes(ipi.typeArray()));
+
+ if (config->showSummary) {
+ nbTypeRecords = ipiSrc->ghashes.size();
+ nbTypeRecordsBytes = ipi.typeArray().getUnderlyingStream().getLength();
+ }
+ }
+
+ if (config->showSummary) {
+ nbTypeRecords += ghashes.size();
+ nbTypeRecordsBytes += tpi.typeArray().getUnderlyingStream().getLength();
}
}
@@ -834,6 +857,10 @@ void UsePrecompSource::remapTpiWithGHashes(GHashState *g) {
mergeUniqueTypeRecords(file->debugTypes,
TypeIndex(precompDependency.getStartTypeIndex() +
precompDependency.getTypesCount()));
+ if (config->showSummary) {
+ nbTypeRecords = ghashes.size();
+ nbTypeRecordsBytes = file->debugTypes.size();
+ }
}
namespace {
diff --git a/lld/COFF/DebugTypes.h b/lld/COFF/DebugTypes.h
index ebb3b2bac693..42485df06f87 100644
--- a/lld/COFF/DebugTypes.h
+++ b/lld/COFF/DebugTypes.h
@@ -182,6 +182,9 @@ class TpiSource {
MergedInfo mergedTpi;
MergedInfo mergedIpi;
+
+ uint64_t nbTypeRecords = 0;
+ uint64_t nbTypeRecordsBytes = 0;
};
TpiSource *makeTpiSource(ObjFile *file);
diff --git a/lld/COFF/PDB.cpp b/lld/COFF/PDB.cpp
index ae2dc9afca28..846d7a11fbfa 100644
--- a/lld/COFF/PDB.cpp
+++ b/lld/COFF/PDB.cpp
@@ -146,6 +146,8 @@ class PDBLinker {
uint64_t globalSymbols = 0;
uint64_t moduleSymbols = 0;
uint64_t publicSymbols = 0;
+ uint64_t nbTypeRecords = 0;
+ uint64_t nbTypeRecordsBytes = 0;
};
class DebugSHandler {
@@ -970,6 +972,13 @@ void PDBLinker::addObjectsToPDB() {
addTypeInfo(builder.getIpiBuilder(), tMerger.getIDTable());
}
t2.stop();
+
+ if (config->showSummary) {
+ for_each(TpiSource::instances, [&](TpiSource *source) {
+ nbTypeRecords += source->nbTypeRecords;
+ nbTypeRecordsBytes += source->nbTypeRecordsBytes;
+ });
+ }
}
void PDBLinker::addPublicsToPDB() {
@@ -1009,6 +1018,8 @@ void PDBLinker::printStats() {
"Input OBJ files (expanded from all cmd-line inputs)");
print(TpiSource::countTypeServerPDBs(), "PDB type server dependencies");
print(TpiSource::countPrecompObjs(), "Precomp OBJ dependencies");
+ print(nbTypeRecords, "Input type records");
+ print(nbTypeRecordsBytes, "Input type records bytes");
print(builder.getTpiBuilder().getRecordCount(), "Merged TPI records");
print(builder.getIpiBuilder().getRecordCount(), "Merged IPI records");
print(pdbStrTab.size(), "Output PDB strings");
diff --git a/lld/test/COFF/pdb-type-server-simple.test b/lld/test/COFF/pdb-type-server-simple.test
index b954712d9b6c..7c72d8fe8669 100644
--- a/lld/test/COFF/pdb-type-server-simple.test
+++ b/lld/test/COFF/pdb-type-server-simple.test
@@ -105,6 +105,8 @@ SUMMARY-NEXT: ------------------------------------------------------------------
SUMMARY-NEXT: 2 Input OBJ files (expanded from all cmd-line inputs)
SUMMARY-NEXT: 1 PDB type server dependencies
SUMMARY-NEXT: 0 Precomp OBJ dependencies
+SUMMARY-NEXT: 25 Input type records
+SUMMARY-NEXT: 868 Input type records bytes
SUMMARY-NEXT: 9 Merged TPI records
SUMMARY-NEXT: 16 Merged IPI records
SUMMARY-NEXT: 3 Output PDB strings
diff --git a/lld/test/COFF/precomp-link.test b/lld/test/COFF/precomp-link.test
index 161ee88d27f5..c9a5c605da8f 100644
--- a/lld/test/COFF/precomp-link.test
+++ b/lld/test/COFF/precomp-link.test
@@ -64,8 +64,10 @@ SUMMARY-NEXT: ------------------------------------------------------------------
SUMMARY-NEXT: 3 Input OBJ files (expanded from all cmd-line inputs)
SUMMARY-NEXT: 0 PDB type server dependencies
SUMMARY-NEXT: 1 Precomp OBJ dependencies
-SUMMARY-NEXT: 874 Merged TPI records
-SUMMARY-NEXT: 170 Merged IPI records
+SUMMARY-NEXT: 1066 Input type records
+SUMMARY-NEXT: 55968 Input type records bytes
+SUMMARY-NEXT: 874 Merged TPI records
+SUMMARY-NEXT: 170 Merged IPI records
SUMMARY-NEXT: 5 Output PDB strings
SUMMARY-NEXT: 167 Global symbol records
SUMMARY-NEXT: 20 Module symbol records
diff --git a/lld/test/COFF/precomp-summary-fail.test b/lld/test/COFF/precomp-summary-fail.test
index b689839be9d2..5ebba9a1d3c7 100644
--- a/lld/test/COFF/precomp-summary-fail.test
+++ b/lld/test/COFF/precomp-summary-fail.test
@@ -14,6 +14,8 @@ SUMMARY-NEXT: ------------------------------------------------------------------
SUMMARY-NEXT: 2 Input OBJ files (expanded from all cmd-line inputs)
SUMMARY-NEXT: 0 PDB type server dependencies
SUMMARY-NEXT: 1 Precomp OBJ dependencies
+SUMMARY-NEXT: 8 Input type records
+SUMMARY-NEXT: 232 Input type records bytes
SUMMARY-NEXT: 3 Merged TPI records
SUMMARY-NEXT: 2 Merged IPI records
SUMMARY-NEXT: 1 Output PDB strings
More information about the llvm-commits
mailing list