I started this effort after noticing that DI shows up as a considerable portion of memory usage during an LTO build (of clang, and others).
This is roughly the data I got (peak usage):
DISubprogram: 228MB
DILocalVariable: 164MB
The proposed patch packs field slightly more efficiently reducing the size of DISubprogram from 48bytes to 40bytes and of DILocalVariable from 40 bytes to 32 bytes.
The saving overall in memory is ~70MB.
This is still to be considered WIP as this breaks 4 tests in the LLVM suite (which I'm currently investigating), but I wanted to have some eyes on it as DebugInfo seems to be of interest of many these days.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Certainly seems like a thing we might want to try - though it'd help to
have a reminder/description of why shrinking these fields to these specific
bit sizes is valid (are the already restricted to those sizes in other
places/ways, for example - point to where/how they're already so restricted)
include/llvm/IR/DebugInfoMetadata.h | ||
---|---|---|
1237 ↗ | (On Diff #53109) | MSVC starts a new container field every time you change the base type, so this won't pack the way you want on Windows. Use unsigned as the base type in all of these. |
include/llvm/IR/DebugInfoMetadata.h | ||
---|---|---|
1237 ↗ | (On Diff #53109) | Oh, sigh. I'll make sure to test with MSVC. |
Addressed reviewers comments. I decided to split the DILocalVariable changes and I'll post another patch soon.
Thanks for your feedback!
include/llvm/IR/DebugInfoMetadata.h | ||
---|---|---|
1257 ↗ | (On Diff #53497) | Should we also have a static assert that log2(DW_VIRTUALITY_max) < 4 here? |
include/llvm/IR/DebugInfoMetadata.h | ||
---|---|---|
1257 ↗ | (On Diff #53505) | Sorry, but it looks like my suggestion was incorrect: It's either log2(DW_VIRTUALITY_max) <= 2 or DW_VIRTUALITY_max < 4. |