[cfe-commits] r131276 - in /cfe/trunk: include/clang/AST/DeclCXX.h lib/AST/DeclCXX.cpp lib/CodeGen/CGBlocks.cpp lib/CodeGen/CodeGenModule.cpp lib/Serialization/ASTReaderDecl.cpp lib/Serialization/ASTWriter.cpp test/CodeGenCXX/global-llvm-constant.cpp

Chris Lattner clattner at apple.com
Fri May 13 08:43:41 PDT 2011


On May 13, 2011, at 8:08 AM, Douglas Gregor wrote:

>>> When determining whether we can make a declaration into a global
>>> constant, also consider whether it's a class type that has any mutable
>>> fields. If so, it can't be a global constant.
>> 
>> Are bits like this really worth putting into the PCH file?  Why not just lazily compute them?
> 
> Lazily computing them would involve deserializing all of the fields within the class and all of its subobjects of class type. That may be fine---we could due so once and compute all of the properties based on those fields at that time---but it's a shame to require extra deserialization to save a bit.

Ok.  I was mostly wondering if anything that would use this bit would require deserializing all those fields anyway.  In this case, the big is used (for example) by codegen of a global, which will have to deserialize the full type.  If this doesn't make sense, it isn't worth doing :)

> These bits in CXXRecordDecl::DefinitionData *do* take up way too much space in the PCH, but the fix should be to make each logical bit take just one bit rather than the current 6 bits (due to the VBR-6 encoding). A simple change there could save us a bunch of I/O.

Yes.  The bitcode format supports use of abbreviations to store this in one bit.  It is probably worth looking at statistics for the common records (using llvm-bcanalyzer) and adding abbrevs for them if you haven't already.
http://llvm.org/docs/BitCodeFormat.html#abbreviations

-Chris



More information about the cfe-commits mailing list