This is an archive of the discontinued LLVM Phabricator instance.

[Serialization] write expr dependence bits as a single integer
ClosedPublic

Authored by sammccall on Apr 22 2022, 5:01 AM.

Details

Summary

When exprs are written unabbreviated:

  • these were encoded as 5 x vbr6 = 30 bits
  • now they fit exactly into a one-chunk vbr = 6 bits

clangd --check=clangd/AST.cpp reports ~1% reduction in PCH size
(42826720->42474460)

Diff Detail

Event Timeline

sammccall created this revision.Apr 22 2022, 5:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 22 2022, 5:01 AM
sammccall requested review of this revision.Apr 22 2022, 5:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 22 2022, 5:01 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
sammccall updated this revision to Diff 424443.Apr 22 2022, 5:05 AM

Don't hardcode 5 dependence bits in abbreviaions.

ilya-biryukov accepted this revision.Apr 25 2022, 2:43 AM

LGTM. Nice savings

clang/lib/Serialization/ASTWriterDecl.cpp
2291

NIT: add constexpr?

This revision is now accepted and ready to land.Apr 25 2022, 2:43 AM
This revision was landed with ongoing or failed builds.Apr 25 2022, 3:09 AM
This revision was automatically updated to reflect the committed changes.

Hi Jake,

I suspect something about the test/runner is nonhermetic, I'm going to try
to fix it in the test.

This commit changes the serialized PCH format.
It looks like this test is not properly hermetic, and is trying to load the
PCH from a previous run of the test. It clears the module dir, but not the
PCH itself.
This would normally trigger a version mismatch error, but the test disables
it with -fdisable-module-hash for some reason.

Only mystery is why the c-index-test line doesn't fail if it doesn't manage
to overwrite the PCH file.

1c65c734c93f8c4d39947e596d7fe89289ce283d will clear the PCH file. If this
doesn't fix the problem I'll revert.

Thanks @sammccall, the test is passing now.