[ThinLTO] Import composite types as declarations
authorTeresa Johnson <tejohnson@google.com>
Fri, 16 Dec 2016 21:25:01 +0000 (21:25 +0000)
committerTeresa Johnson <tejohnson@google.com>
Fri, 16 Dec 2016 21:25:01 +0000 (21:25 +0000)
commita61f5e379675732666744bcba25efbc9922e016a
treee9fca58ec6916e678a6fc2d90bb2b00c3846c0e5
parent3ca147ea3d8c2364542c2e4c2b7ba83fdf5e6dcd
[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
llvm/include/llvm/Bitcode/BitcodeReader.h
llvm/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/lib/Bitcode/Reader/MetadataLoader.cpp
llvm/lib/Bitcode/Reader/MetadataLoader.h
llvm/lib/LTO/LTO.cpp
llvm/lib/LTO/LTOBackend.cpp
llvm/lib/LTO/ThinLTOCodeGenerator.cpp
llvm/lib/Object/IRObjectFile.cpp
llvm/test/ThinLTO/X86/Inputs/debuginfo-compositetype-import.ll [new file with mode: 0644]
llvm/test/ThinLTO/X86/debuginfo-compositetype-import.ll [new file with mode: 0644]