[llvm] r349431 - [codeview] Align symbol records to save 441MB during linking clang.pdb

Friedman, Eli via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 17 17:33:51 PST 2018


On 12/17/2018 5:14 PM, Reid Kleckner via llvm-commits wrote:
> Author: rnk
> Date: Mon Dec 17 17:14:05 2018
> New Revision: 349431
>
> URL: http://llvm.org/viewvc/llvm-project?rev=349431&view=rev
> Log:
> [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
>
> Modified:
>      llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
>      llvm/trunk/test/DebugInfo/COFF/frameproc-flags.ll
>      llvm/trunk/test/DebugInfo/COFF/multifunction.ll
>      llvm/trunk/test/DebugInfo/COFF/simple.ll
>      llvm/trunk/test/DebugInfo/COFF/thunk.ll
>      llvm/trunk/test/DebugInfo/COFF/types-cvarargs.ll
>      llvm/trunk/test/DebugInfo/COFF/udts-complete.ll
>      llvm/trunk/test/DebugInfo/COFF/udts.ll
>      llvm/trunk/test/DebugInfo/COFF/vframe-fpo.ll
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp?rev=349431&r1=349430&r2=349431&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp Mon Dec 17 17:14:05 2018
> @@ -2833,6 +2833,7 @@ MCSymbol *CodeViewDebug::beginSymbolReco
>   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);

Fix the comment here?

-Eli

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project



More information about the llvm-commits mailing list