[PATCH] D124420: [Serialization] Compress serialized macro expansion SLocEntries

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 25 15:47:01 PDT 2022

sammccall created this revision.
sammccall added a reviewer: ilya-biryukov.
Herald added a project: All.
sammccall requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Macro expansion SLocEntries are significant to PCH size (7-10% in my tests).
These store the expansion end location as vbr8. However it's highly predictable:

- for macro arg expansion it's zero
- for object macros it equals the expansion start
- for function macros it's usually shortly after the expansion start

Instead, this change stores (bool relative, unsigned value).
If relative is true, ExpEnd is ExpBegin+value, otherwise it's just value.
We define abbreviations to cover the common cases above.

This saves ~15% of SM_SLOC_EXPANSION, which is 1-1.5% of overall PCH size.

  rG LLVM Github Monorepo



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124420.425042.patch
Type: text/x-patch
Size: 7207 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220425/f03cd649/attachment.bin>

More information about the cfe-commits mailing list