-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[LLD][COFF] Display the size of all consumed inputs with /summary
#157279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
When `/summary` is used, we now also display the cumulative size of all input OBJ files, including those pulled from archives. Lazy OBJ files that were not pulled in are not accounted for. Example output: ``` > lld-link ... /summary ```
|
@llvm/pr-subscribers-lld-coff Author: Alexandre Ganea (aganea) ChangesWhen Example output: Full diff: https://github.com/llvm/llvm-project/pull/157279.diff 7 Files Affected:
diff --git a/lld/COFF/COFFLinkerContext.h b/lld/COFF/COFFLinkerContext.h
index f45b754384ef9..b44263b5a3390 100644
--- a/lld/COFF/COFFLinkerContext.h
+++ b/lld/COFF/COFFLinkerContext.h
@@ -61,6 +61,7 @@ class COFFLinkerContext : public CommonLinkerContext {
std::vector<ObjFile *> objFileInstances;
std::map<std::string, PDBInputFile *> pdbInputFileInstances;
std::vector<ImportFile *> importFileInstances;
+ std::int64_t consumedInputsSize = 0;
MergeChunk *mergeChunkInstances[Log2MaxSectionAlignment + 1] = {};
diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index 852c509a5c77d..ba208c212d67e 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -205,6 +205,7 @@ void LinkerDriver::addFile(InputFile *file) {
else
cast<ObjFile>(file)->parseLazy();
} else {
+ ctx.consumedInputsSize += file->mb.getBufferSize();
file->parse();
if (auto *f = dyn_cast<ObjFile>(file)) {
ctx.objFileInstances.push_back(f);
diff --git a/lld/COFF/PDB.cpp b/lld/COFF/PDB.cpp
index 94eeae2797971..a275a68bbc3e8 100644
--- a/lld/COFF/PDB.cpp
+++ b/lld/COFF/PDB.cpp
@@ -44,6 +44,7 @@
#include "llvm/Object/CVDebugRecord.h"
#include "llvm/Support/CRC.h"
#include "llvm/Support/Endian.h"
+#include "llvm/Support/FormatAdapters.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/ScopedPrinter.h"
@@ -1247,11 +1248,14 @@ void PDBLinker::printStats() {
<< std::string(80, '-') << '\n';
auto print = [&](uint64_t v, StringRef s) {
- stream << format_decimal(v, 15) << " " << s << '\n';
+ stream << formatv("{0}",
+ fmt_align(formatv("{0:N}", v), AlignStyle::Right, 20))
+ << " " << s << '\n';
};
print(ctx.objFileInstances.size(),
"Input OBJ files (expanded from all cmd-line inputs)");
+ print(ctx.consumedInputsSize, "Size of all consumed OBJ files (non-lazy)");
print(ctx.typeServerSourceMappings.size(), "PDB type server dependencies");
print(ctx.precompSourceMappings.size(), "Precomp OBJ dependencies");
print(nbTypeRecords, "Input type records");
diff --git a/lld/test/COFF/pdb-type-server-simple.test b/lld/test/COFF/pdb-type-server-simple.test
index 93d66cde4f712..7881323c05d45 100644
--- a/lld/test/COFF/pdb-type-server-simple.test
+++ b/lld/test/COFF/pdb-type-server-simple.test
@@ -106,17 +106,18 @@ CHECK-LABEL: Mod 0002 | `* Linker *`:
SUMMARY: Summary
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
-SUMMARY-NEXT: 4 Global symbol records
-SUMMARY-NEXT: 14 Module symbol records
-SUMMARY-NEXT: 2 Public symbol records
+SUMMARY-NEXT: 2 Input OBJ files (expanded from all cmd-line inputs)
+SUMMARY-NEXT: Size of all consumed OBJ files (non-lazy)
+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
+SUMMARY-NEXT: 4 Global symbol records
+SUMMARY-NEXT: 14 Module symbol records
+SUMMARY-NEXT: 2 Public symbol records
SUMMARY: Top 10 types responsible for the most TPI input:
SUMMARY-NEXT: index total bytes count size
diff --git a/lld/test/COFF/precomp-link-samename.test b/lld/test/COFF/precomp-link-samename.test
index f44abf289d867..8cd2533087f09 100644
--- a/lld/test/COFF/precomp-link-samename.test
+++ b/lld/test/COFF/precomp-link-samename.test
@@ -12,9 +12,10 @@ CHECK-NOT: LF_ENDPRECOMP
SUMMARY: Summary
SUMMARY-NEXT: --------------------------------------------------------------------------------
-SUMMARY-NEXT: 4 Input OBJ files (expanded from all cmd-line inputs)
-SUMMARY-NEXT: 0 PDB type server dependencies
-SUMMARY-NEXT: 2 Precomp OBJ dependencies
+SUMMARY-NEXT: 4 Input OBJ files (expanded from all cmd-line inputs)
+SUMMARY-NEXT: Size of all consumed OBJ files (non-lazy)
+SUMMARY-NEXT: 0 PDB type server dependencies
+SUMMARY-NEXT: 2 Precomp OBJ dependencies
// precompa/precomp.cpp
#include "precomp.h"
diff --git a/lld/test/COFF/precomp-link.test b/lld/test/COFF/precomp-link.test
index ce90603d0bb87..ffe6f57c9ed46 100644
--- a/lld/test/COFF/precomp-link.test
+++ b/lld/test/COFF/precomp-link.test
@@ -59,17 +59,18 @@ CHECK-NOT: LF_ENDPRECOMP
SUMMARY: Summary
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: 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
-SUMMARY-NEXT: 3 Public symbol records
+SUMMARY-NEXT: 3 Input OBJ files (expanded from all cmd-line inputs)
+SUMMARY-NEXT: Size of all consumed OBJ files (non-lazy)
+SUMMARY-NEXT: 0 PDB type server dependencies
+SUMMARY-NEXT: 1 Precomp OBJ dependencies
+SUMMARY-NEXT: 1,066 Input type records
+SUMMARY-NEXT: 55,968 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
+SUMMARY-NEXT: 3 Public symbol records
// precomp.h
#pragma once
diff --git a/lld/test/COFF/precomp-summary-fail.test b/lld/test/COFF/precomp-summary-fail.test
index 5ebba9a1d3c74..49a7ca18afdbe 100644
--- a/lld/test/COFF/precomp-summary-fail.test
+++ b/lld/test/COFF/precomp-summary-fail.test
@@ -11,14 +11,15 @@ RUN: /dll /out:%t.dll /debug /summary | FileCheck %s -check-prefix SUMMARY
SUMMARY: Summary
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
-SUMMARY-NEXT: 0 Global symbol records
-SUMMARY-NEXT: 4 Module symbol records
-SUMMARY-NEXT: 0 Public symbol records
+SUMMARY-NEXT: 2 Input OBJ files (expanded from all cmd-line inputs)
+SUMMARY-NEXT: Size of all consumed OBJ files (non-lazy)
+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
+SUMMARY-NEXT: 0 Global symbol records
+SUMMARY-NEXT: 4 Module symbol records
+SUMMARY-NEXT: 0 Public symbol records
|
|
@llvm/pr-subscribers-platform-windows Author: Alexandre Ganea (aganea) ChangesWhen Example output: Full diff: https://github.com/llvm/llvm-project/pull/157279.diff 7 Files Affected:
diff --git a/lld/COFF/COFFLinkerContext.h b/lld/COFF/COFFLinkerContext.h
index f45b754384ef9..b44263b5a3390 100644
--- a/lld/COFF/COFFLinkerContext.h
+++ b/lld/COFF/COFFLinkerContext.h
@@ -61,6 +61,7 @@ class COFFLinkerContext : public CommonLinkerContext {
std::vector<ObjFile *> objFileInstances;
std::map<std::string, PDBInputFile *> pdbInputFileInstances;
std::vector<ImportFile *> importFileInstances;
+ std::int64_t consumedInputsSize = 0;
MergeChunk *mergeChunkInstances[Log2MaxSectionAlignment + 1] = {};
diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index 852c509a5c77d..ba208c212d67e 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -205,6 +205,7 @@ void LinkerDriver::addFile(InputFile *file) {
else
cast<ObjFile>(file)->parseLazy();
} else {
+ ctx.consumedInputsSize += file->mb.getBufferSize();
file->parse();
if (auto *f = dyn_cast<ObjFile>(file)) {
ctx.objFileInstances.push_back(f);
diff --git a/lld/COFF/PDB.cpp b/lld/COFF/PDB.cpp
index 94eeae2797971..a275a68bbc3e8 100644
--- a/lld/COFF/PDB.cpp
+++ b/lld/COFF/PDB.cpp
@@ -44,6 +44,7 @@
#include "llvm/Object/CVDebugRecord.h"
#include "llvm/Support/CRC.h"
#include "llvm/Support/Endian.h"
+#include "llvm/Support/FormatAdapters.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/ScopedPrinter.h"
@@ -1247,11 +1248,14 @@ void PDBLinker::printStats() {
<< std::string(80, '-') << '\n';
auto print = [&](uint64_t v, StringRef s) {
- stream << format_decimal(v, 15) << " " << s << '\n';
+ stream << formatv("{0}",
+ fmt_align(formatv("{0:N}", v), AlignStyle::Right, 20))
+ << " " << s << '\n';
};
print(ctx.objFileInstances.size(),
"Input OBJ files (expanded from all cmd-line inputs)");
+ print(ctx.consumedInputsSize, "Size of all consumed OBJ files (non-lazy)");
print(ctx.typeServerSourceMappings.size(), "PDB type server dependencies");
print(ctx.precompSourceMappings.size(), "Precomp OBJ dependencies");
print(nbTypeRecords, "Input type records");
diff --git a/lld/test/COFF/pdb-type-server-simple.test b/lld/test/COFF/pdb-type-server-simple.test
index 93d66cde4f712..7881323c05d45 100644
--- a/lld/test/COFF/pdb-type-server-simple.test
+++ b/lld/test/COFF/pdb-type-server-simple.test
@@ -106,17 +106,18 @@ CHECK-LABEL: Mod 0002 | `* Linker *`:
SUMMARY: Summary
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
-SUMMARY-NEXT: 4 Global symbol records
-SUMMARY-NEXT: 14 Module symbol records
-SUMMARY-NEXT: 2 Public symbol records
+SUMMARY-NEXT: 2 Input OBJ files (expanded from all cmd-line inputs)
+SUMMARY-NEXT: Size of all consumed OBJ files (non-lazy)
+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
+SUMMARY-NEXT: 4 Global symbol records
+SUMMARY-NEXT: 14 Module symbol records
+SUMMARY-NEXT: 2 Public symbol records
SUMMARY: Top 10 types responsible for the most TPI input:
SUMMARY-NEXT: index total bytes count size
diff --git a/lld/test/COFF/precomp-link-samename.test b/lld/test/COFF/precomp-link-samename.test
index f44abf289d867..8cd2533087f09 100644
--- a/lld/test/COFF/precomp-link-samename.test
+++ b/lld/test/COFF/precomp-link-samename.test
@@ -12,9 +12,10 @@ CHECK-NOT: LF_ENDPRECOMP
SUMMARY: Summary
SUMMARY-NEXT: --------------------------------------------------------------------------------
-SUMMARY-NEXT: 4 Input OBJ files (expanded from all cmd-line inputs)
-SUMMARY-NEXT: 0 PDB type server dependencies
-SUMMARY-NEXT: 2 Precomp OBJ dependencies
+SUMMARY-NEXT: 4 Input OBJ files (expanded from all cmd-line inputs)
+SUMMARY-NEXT: Size of all consumed OBJ files (non-lazy)
+SUMMARY-NEXT: 0 PDB type server dependencies
+SUMMARY-NEXT: 2 Precomp OBJ dependencies
// precompa/precomp.cpp
#include "precomp.h"
diff --git a/lld/test/COFF/precomp-link.test b/lld/test/COFF/precomp-link.test
index ce90603d0bb87..ffe6f57c9ed46 100644
--- a/lld/test/COFF/precomp-link.test
+++ b/lld/test/COFF/precomp-link.test
@@ -59,17 +59,18 @@ CHECK-NOT: LF_ENDPRECOMP
SUMMARY: Summary
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: 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
-SUMMARY-NEXT: 3 Public symbol records
+SUMMARY-NEXT: 3 Input OBJ files (expanded from all cmd-line inputs)
+SUMMARY-NEXT: Size of all consumed OBJ files (non-lazy)
+SUMMARY-NEXT: 0 PDB type server dependencies
+SUMMARY-NEXT: 1 Precomp OBJ dependencies
+SUMMARY-NEXT: 1,066 Input type records
+SUMMARY-NEXT: 55,968 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
+SUMMARY-NEXT: 3 Public symbol records
// precomp.h
#pragma once
diff --git a/lld/test/COFF/precomp-summary-fail.test b/lld/test/COFF/precomp-summary-fail.test
index 5ebba9a1d3c74..49a7ca18afdbe 100644
--- a/lld/test/COFF/precomp-summary-fail.test
+++ b/lld/test/COFF/precomp-summary-fail.test
@@ -11,14 +11,15 @@ RUN: /dll /out:%t.dll /debug /summary | FileCheck %s -check-prefix SUMMARY
SUMMARY: Summary
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
-SUMMARY-NEXT: 0 Global symbol records
-SUMMARY-NEXT: 4 Module symbol records
-SUMMARY-NEXT: 0 Public symbol records
+SUMMARY-NEXT: 2 Input OBJ files (expanded from all cmd-line inputs)
+SUMMARY-NEXT: Size of all consumed OBJ files (non-lazy)
+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
+SUMMARY-NEXT: 0 Global symbol records
+SUMMARY-NEXT: 4 Module symbol records
+SUMMARY-NEXT: 0 Public symbol records
|
|
@llvm/pr-subscribers-lld Author: Alexandre Ganea (aganea) ChangesWhen Example output: Full diff: https://github.com/llvm/llvm-project/pull/157279.diff 7 Files Affected:
diff --git a/lld/COFF/COFFLinkerContext.h b/lld/COFF/COFFLinkerContext.h
index f45b754384ef9..b44263b5a3390 100644
--- a/lld/COFF/COFFLinkerContext.h
+++ b/lld/COFF/COFFLinkerContext.h
@@ -61,6 +61,7 @@ class COFFLinkerContext : public CommonLinkerContext {
std::vector<ObjFile *> objFileInstances;
std::map<std::string, PDBInputFile *> pdbInputFileInstances;
std::vector<ImportFile *> importFileInstances;
+ std::int64_t consumedInputsSize = 0;
MergeChunk *mergeChunkInstances[Log2MaxSectionAlignment + 1] = {};
diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index 852c509a5c77d..ba208c212d67e 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -205,6 +205,7 @@ void LinkerDriver::addFile(InputFile *file) {
else
cast<ObjFile>(file)->parseLazy();
} else {
+ ctx.consumedInputsSize += file->mb.getBufferSize();
file->parse();
if (auto *f = dyn_cast<ObjFile>(file)) {
ctx.objFileInstances.push_back(f);
diff --git a/lld/COFF/PDB.cpp b/lld/COFF/PDB.cpp
index 94eeae2797971..a275a68bbc3e8 100644
--- a/lld/COFF/PDB.cpp
+++ b/lld/COFF/PDB.cpp
@@ -44,6 +44,7 @@
#include "llvm/Object/CVDebugRecord.h"
#include "llvm/Support/CRC.h"
#include "llvm/Support/Endian.h"
+#include "llvm/Support/FormatAdapters.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/ScopedPrinter.h"
@@ -1247,11 +1248,14 @@ void PDBLinker::printStats() {
<< std::string(80, '-') << '\n';
auto print = [&](uint64_t v, StringRef s) {
- stream << format_decimal(v, 15) << " " << s << '\n';
+ stream << formatv("{0}",
+ fmt_align(formatv("{0:N}", v), AlignStyle::Right, 20))
+ << " " << s << '\n';
};
print(ctx.objFileInstances.size(),
"Input OBJ files (expanded from all cmd-line inputs)");
+ print(ctx.consumedInputsSize, "Size of all consumed OBJ files (non-lazy)");
print(ctx.typeServerSourceMappings.size(), "PDB type server dependencies");
print(ctx.precompSourceMappings.size(), "Precomp OBJ dependencies");
print(nbTypeRecords, "Input type records");
diff --git a/lld/test/COFF/pdb-type-server-simple.test b/lld/test/COFF/pdb-type-server-simple.test
index 93d66cde4f712..7881323c05d45 100644
--- a/lld/test/COFF/pdb-type-server-simple.test
+++ b/lld/test/COFF/pdb-type-server-simple.test
@@ -106,17 +106,18 @@ CHECK-LABEL: Mod 0002 | `* Linker *`:
SUMMARY: Summary
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
-SUMMARY-NEXT: 4 Global symbol records
-SUMMARY-NEXT: 14 Module symbol records
-SUMMARY-NEXT: 2 Public symbol records
+SUMMARY-NEXT: 2 Input OBJ files (expanded from all cmd-line inputs)
+SUMMARY-NEXT: Size of all consumed OBJ files (non-lazy)
+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
+SUMMARY-NEXT: 4 Global symbol records
+SUMMARY-NEXT: 14 Module symbol records
+SUMMARY-NEXT: 2 Public symbol records
SUMMARY: Top 10 types responsible for the most TPI input:
SUMMARY-NEXT: index total bytes count size
diff --git a/lld/test/COFF/precomp-link-samename.test b/lld/test/COFF/precomp-link-samename.test
index f44abf289d867..8cd2533087f09 100644
--- a/lld/test/COFF/precomp-link-samename.test
+++ b/lld/test/COFF/precomp-link-samename.test
@@ -12,9 +12,10 @@ CHECK-NOT: LF_ENDPRECOMP
SUMMARY: Summary
SUMMARY-NEXT: --------------------------------------------------------------------------------
-SUMMARY-NEXT: 4 Input OBJ files (expanded from all cmd-line inputs)
-SUMMARY-NEXT: 0 PDB type server dependencies
-SUMMARY-NEXT: 2 Precomp OBJ dependencies
+SUMMARY-NEXT: 4 Input OBJ files (expanded from all cmd-line inputs)
+SUMMARY-NEXT: Size of all consumed OBJ files (non-lazy)
+SUMMARY-NEXT: 0 PDB type server dependencies
+SUMMARY-NEXT: 2 Precomp OBJ dependencies
// precompa/precomp.cpp
#include "precomp.h"
diff --git a/lld/test/COFF/precomp-link.test b/lld/test/COFF/precomp-link.test
index ce90603d0bb87..ffe6f57c9ed46 100644
--- a/lld/test/COFF/precomp-link.test
+++ b/lld/test/COFF/precomp-link.test
@@ -59,17 +59,18 @@ CHECK-NOT: LF_ENDPRECOMP
SUMMARY: Summary
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: 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
-SUMMARY-NEXT: 3 Public symbol records
+SUMMARY-NEXT: 3 Input OBJ files (expanded from all cmd-line inputs)
+SUMMARY-NEXT: Size of all consumed OBJ files (non-lazy)
+SUMMARY-NEXT: 0 PDB type server dependencies
+SUMMARY-NEXT: 1 Precomp OBJ dependencies
+SUMMARY-NEXT: 1,066 Input type records
+SUMMARY-NEXT: 55,968 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
+SUMMARY-NEXT: 3 Public symbol records
// precomp.h
#pragma once
diff --git a/lld/test/COFF/precomp-summary-fail.test b/lld/test/COFF/precomp-summary-fail.test
index 5ebba9a1d3c74..49a7ca18afdbe 100644
--- a/lld/test/COFF/precomp-summary-fail.test
+++ b/lld/test/COFF/precomp-summary-fail.test
@@ -11,14 +11,15 @@ RUN: /dll /out:%t.dll /debug /summary | FileCheck %s -check-prefix SUMMARY
SUMMARY: Summary
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
-SUMMARY-NEXT: 0 Global symbol records
-SUMMARY-NEXT: 4 Module symbol records
-SUMMARY-NEXT: 0 Public symbol records
+SUMMARY-NEXT: 2 Input OBJ files (expanded from all cmd-line inputs)
+SUMMARY-NEXT: Size of all consumed OBJ files (non-lazy)
+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
+SUMMARY-NEXT: 0 Global symbol records
+SUMMARY-NEXT: 4 Module symbol records
+SUMMARY-NEXT: 0 Public symbol records
|
|
Appologies, I didn't mean to commit this, I thought the auto-merge was conditional on PR approval. I will revert. |
…s with `/summary`" (#157282) Reverts llvm/llvm-project#157279
…ke 2) (#157284) When `/summary` is used, we now also display the cumulative size of all input OBJ files, including those pulled from archives. Lazy OBJ files that were not pulled in are not accounted for. Also added separators between digit groups, to make the output more bearable. Example output: ``` > lld-link ... /summary Summary -------------------------------------------------------------------------------- 4,958 Input OBJ files (expanded from all cmd-line inputs) 46,715,790,512 Size of all consumed OBJ files (non-lazy), in bytes 42 PDB type server dependencies 0 Precomp OBJ dependencies 293,910,064 Input type records 16,931,361,928 Size of all input type records, in bytes 11,201,549 Merged TPI records 2,765,494 Merged IPI records 38,649 Output PDB strings 21,512,230 Global symbol records 82,380,837 Module symbol records 715,313 Public symbol records ``` I've skipped over the exact amounts for "Size of all consumed inputs (non-lazy)" in the unit tests, since the sizes of OBJ files can fluctuate between compilers. _(this is a reopening of #157279 which wasa committed by mistake)_
…summary (take 2) (#157284)
When `/summary` is used, we now also display the cumulative size of all
input OBJ files, including those pulled from archives. Lazy OBJ files
that were not pulled in are not accounted for.
Also added separators between digit groups, to make the output more
bearable.
Example output:
```
> lld-link ... /summary
Summary
--------------------------------------------------------------------------------
4,958 Input OBJ files (expanded from all cmd-line inputs)
46,715,790,512 Size of all consumed OBJ files (non-lazy), in bytes
42 PDB type server dependencies
0 Precomp OBJ dependencies
293,910,064 Input type records
16,931,361,928 Size of all input type records, in bytes
11,201,549 Merged TPI records
2,765,494 Merged IPI records
38,649 Output PDB strings
21,512,230 Global symbol records
82,380,837 Module symbol records
715,313 Public symbol records
```
I've skipped over the exact amounts for "Size of all consumed inputs
(non-lazy)" in the unit tests, since the sizes of OBJ files can
fluctuate between compilers.
_(this is a reopening of
llvm/llvm-project#157279 which wasa committed by
mistake)_
When
/summaryis used, we now also display the cumulative size of all input OBJ files, including those pulled from archives. Lazy OBJ files that were not pulled in are not accounted for.Also added separators between digit groups, to make the output more bearable.
Example output:
I've skipped over the exact amounts for "Size of all consumed inputs (non-lazy)" in the unit tests, since the sizes of OBJ files can fluctuate between compilers.