This is an archive of the discontinued LLVM Phabricator instance.

[CodeView] Combine variable def ranges that are continuous.
ClosedPublic

Authored by zequanwu on May 16 2022, 1:02 PM.

Details

Summary

It saves about 1.13% size for chrome.dll.pdb on chrome official build.

Diff Detail

Event Timeline

zequanwu created this revision.May 16 2022, 1:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 16 2022, 1:02 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
zequanwu requested review of this revision.May 16 2022, 1:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 16 2022, 1:02 PM
zequanwu updated this revision to Diff 429843.May 16 2022, 2:09 PM

Update test.

zequanwu retitled this revision from [WIP][CodeView] Combine variable def ranges that are continuous. to [CodeView] Combine variable def ranges that are continuous..May 16 2022, 2:15 PM
zequanwu added a reviewer: rnk.
zequanwu updated this revision to Diff 429850.May 16 2022, 2:17 PM

Remove unnecessary includes.

zequanwu edited the summary of this revision. (Show Details)May 18 2022, 10:51 AM
rnk added a comment.May 18 2022, 4:31 PM

Nice!

llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
78

To minimize the amount of code that needs to know or assume the size of LocalVarDefRange, I recommend exposing a method, maybe called toOpaqueValue, which returns a uint64_t. Then, all of these methods don't need to do memcpy, they just call that method, and compare or operate on integer values as you have them. You may also need createFromOpaqueValue or something like that.

91

Prefer sizeof(Val) to hardcoding 8. It's worth adding static_assert(sizeof(uint64_t) == sizeof(LocalVarDefRange)); to ensure that the bitfields are packed as expected.

520

Instead of inheritance, can all those methods be defined here?

zequanwu updated this revision to Diff 430540.May 18 2022, 5:13 PM
zequanwu marked 3 inline comments as done.
  • Address comments.
  • Rename LocalVarDefRange to LocalVarDef as it no longer has range info inside.
rnk accepted this revision.May 20 2022, 11:13 AM

lgtm, thanks!

llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
521

You may need to use ULL sufixes so that this compiles as you expect on LLP64 platforms, such as Windows x64.

This revision is now accepted and ready to land.May 20 2022, 11:13 AM
This revision was landed with ongoing or failed builds.May 20 2022, 12:12 PM
This revision was automatically updated to reflect the committed changes.
zequanwu marked an inline comment as done.