[PATCH] D72427: [DebugInfo] Add option to clang to limit debug info that is emitted for classes.

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 13 16:03:45 PST 2020


rnk added a comment.

> Total object file size on Windows, compiling with RelWithDebInfo:
> 
> before: 4,257,448 kb
>  after:  2,104,963 kb
> 
> And on Linux
> 
> before: 9,225,140 kb
>  after:  4,387,464 kb

These numbers are amazing!

I made a summary of Amy's list of types that become incomplete here: https://reviews.llvm.org/P8184
It collapses template parameters and counts up instantiations.

I picked some types at random to analyze:

- llvm::MachineModuleAnalysis: Looks like this type is required to be complete, but never actually constructed in LLVM. Amusing, seems working-as-intended.
- llvm::IntrinsicLowering: ditto
- llvm::ArrayRef<llvm::wasm::WasmElemSegment>: Used here: http://llvm-cs.pcc.me.uk/include/llvm/Object/Wasm.h/relements This seems WAI, it is only used in LLD, not clang, so we don't need it to debug clang.

In D72427#1812515 <https://reviews.llvm.org/D72427#1812515>, @dblaikie wrote:

> What's the plan for this? Is it still in an experimental stage, with the intent to investigate the types that are no longer emitted unedr the flag & explain why they're missing (& either have a justification for why that's acceptable, or work on additional heuristics to address the gaps?)?
>
> If so, I'd probably rather this not be a full driver flag - if it's a reliable way to reduce debug info size (like the existing heuristics under -fstandalone-debug*) it should be rolled into -fno-standalone-debug behavior, and if it's not fully fleshed out yet, I think an -Xclang flag would be more suitable for the experimental phase.
>
> Do you have any sample of data on the sort of situations that lead to missing types under this heuristic?


I'm glad you think we might eventually be able to roll this into fno-standalone-debug. :)

However, it is possible for the user to require a type to be complete, but never construct it, as is typically the case for type traits. This patch continues to emit most type trait classes, because they lack user-declared constructors, but you could imagine giving such a class a constructor and never calling it, and then later trying to look at it in the debugger. In this new mode, it would be missing, probably just forward declared.

Do you think the user should have a mode between the constructor mode and the standalone mode? Our current mode is also pretty close to what GCC does, so we might want to keep the current mode for users who mix GCC and Clang debug info. Alternatively, we could give users some kind of attribute escape hatch to force-emit some particular type information.

In any case, we don't have to answer this question to land the -cc1 mode, as you have already discussed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72427/new/

https://reviews.llvm.org/D72427





More information about the cfe-commits mailing list