summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Reader/MetadataLoader.h
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2016-12-16 21:25:01 +0000
committerTeresa Johnson <tejohnson@google.com>2016-12-16 21:25:01 +0000
commita61f5e379675732666744bcba25efbc9922e016a (patch)
treee9fca58ec6916e678a6fc2d90bb2b00c3846c0e5 /llvm/lib/Bitcode/Reader/MetadataLoader.h
parent3ca147ea3d8c2364542c2e4c2b7ba83fdf5e6dcd (diff)
downloadbcm5719-llvm-a61f5e379675732666744bcba25efbc9922e016a.tar.gz
bcm5719-llvm-a61f5e379675732666744bcba25efbc9922e016a.zip
[ThinLTO] Import composite types as declarations
Summary: When reading the metadata bitcode, create a type declaration when possible for composite types when we are importing. Doing this in the bitcode reader saves memory. Also it works naturally in the case when the type ODR map contains a definition for the same composite type because it was used in the importing module (buildODRType will automatically use the existing definition and not create a type declaration). For Chromium built with -g2, this reduces the aggregate size of the generated native object files by 66% (from 31G to 10G). It reduced the time through the ThinLTO link and backend phases by about 20% on my machine. Reviewers: mehdi_amini, dblaikie, aprantl Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D27775 llvm-svn: 289993
Diffstat (limited to 'llvm/lib/Bitcode/Reader/MetadataLoader.h')
-rw-r--r--llvm/lib/Bitcode/Reader/MetadataLoader.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Bitcode/Reader/MetadataLoader.h b/llvm/lib/Bitcode/Reader/MetadataLoader.h
index 7d1027e9d52..351857e342c 100644
--- a/llvm/lib/Bitcode/Reader/MetadataLoader.h
+++ b/llvm/lib/Bitcode/Reader/MetadataLoader.h
@@ -36,12 +36,14 @@ class Type;
class MetadataLoader {
class MetadataLoaderImpl;
std::unique_ptr<MetadataLoaderImpl> Pimpl;
+ /// True if metadata is being parsed for a module being ThinLTO imported.
+ bool IsImporting = false;
Error parseMetadata(bool ModuleLevel);
public:
~MetadataLoader();
MetadataLoader(BitstreamCursor &Stream, Module &TheModule,
- BitcodeReaderValueList &ValueList,
+ BitcodeReaderValueList &ValueList, bool IsImporting,
std::function<Type *(unsigned)> getTypeByID);
MetadataLoader &operator=(MetadataLoader &&);
MetadataLoader(MetadataLoader &&);
OpenPOWER on IntegriCloud