summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2018-12-18 01:14:05 +0000
committerReid Kleckner <rnk@google.com>2018-12-18 01:14:05 +0000
commit53ce05960e851bf46caf5b4a8d209f16836b2f89 (patch)
treede83b4a80672494195324bc4fde93bc777e3406d /llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
parentc4e08feb002ffc32d0f37505134c4eddb1a784f7 (diff)
downloadbcm5719-llvm-53ce05960e851bf46caf5b4a8d209f16836b2f89.tar.gz
bcm5719-llvm-53ce05960e851bf46caf5b4a8d209f16836b2f89.zip
[codeview] Align symbol records to save 441MB during linking clang.pdb
In PDBs, symbol records must be aligned to four bytes. However, in the object file, symbol records may not be aligned. MSVC does not pad out symbol records to make sure they are aligned. That means the linker has to do extra work to insert the padding. Currently, LLD calculates the required space with alignment, and copies each record one at a time while padding them out to the correct size. It has a fast path that avoids this copy when the records are already aligned. This change fixes a bug in that codepath so that the copy is actually saved, and tweaks LLVM's symbol record emission to align symbol records. Here's how things compare when doing a plain clang Release+PDB build: - objs are 0.65% bigger (negligible) - link is 3.3% faster (negligible) - saves allocating 441MB - new LLD high water mark is ~1.05GB llvm-svn: 349431
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
index 93b76997c07..78e5f5d215b 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -2833,6 +2833,7 @@ MCSymbol *CodeViewDebug::beginSymbolRecord(SymbolKind SymKind) {
void CodeViewDebug::endSymbolRecord(MCSymbol *SymEnd) {
// Symbol records in object files are not aligned, although we are considering
// it for linker performance reasons.
+ OS.EmitValueToAlignment(4);
OS.EmitLabel(SymEnd);
}
OpenPOWER on IntegriCloud