[all-commits] [llvm/llvm-project] 586f65: Add a key method to Sema to optimize debug info size

Reid Kleckner via All-commits all-commits at lists.llvm.org
Tue Nov 19 12:44:48 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 586f65d31f32ca6bc8cfdb8a4f61bee5057bf6c8
      https://github.com/llvm/llvm-project/commit/586f65d31f32ca6bc8cfdb8a4f61bee5057bf6c8
  Author: Reid Kleckner <rnk at google.com>
  Date:   2019-11-19 (Tue, 19 Nov 2019)

  Changed paths:
    M clang/include/clang/Sema/Sema.h
    M clang/lib/Sema/Sema.cpp

  Log Message:
  -----------
  Add a key method to Sema to optimize debug info size

It turns out that the debug info describing the Sema class is an
appreciable percentage of the total object file size of objects in Sema.
By adding a key function, clang is able to optimize the debug info size
by emitting a forward declaration in TUs that do not define the key
function.

On Windows, with clang-cl, these are the total sizes of object files in
Sema before and after this change, compiling with optimizations and
debug info:
  before: 335,012 KB
  after:  278,116 KB
  delta:  -56,896 KB
  percent: -17.0%

The effect on link time was negligible, despite having ~56MB less input.

On Linux, with clang, these are the same sizes using DWARF -g and
optimizations:
  before: 603,756 KB
  after:  515,340 KB
  delta:  -88,416 KB
  percent: -14.6%

I didn't use type units, DWARF-5, fission, or any other special flags.

Reviewed By: thakis

Differential Revision: https://reviews.llvm.org/D70340




More information about the All-commits mailing list