mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
[ThinLTOBitcodeWriter] Emit summaries for regular LTO modules
Summary: Emit summaries for bitcode modules that are only destined for the regular LTO portion of the build so they can participate in summary-based dead stripping. This change reduces the size of a nacl_helper build with cfi-icall enabled by 7%, removing the majority of the overhead due to enabling cfi-icall. The cfi-icall size increase was caused by compiling in lots of unused code and cfi-icall generating jumptable references to unused symbols that could no longer be removed by -Wl,-gc-sections. Increasing the visibility of summary-based dead stripping prevented jumptable entries being created for unused symbols from the regular LTO portion of the build. Reviewers: pcc Reviewed By: pcc Subscribers: dschuff, mehdi_amini, inglorion, eraman, llvm-commits, kcc Differential Revision: https://reviews.llvm.org/D47594 llvm-svn: 333768
This commit is contained in:
parent
13034d4b5f
commit
ec4a2d665c
@ -200,13 +200,19 @@ void splitAndWriteThinLTOBitcode(
|
||||
function_ref<AAResults &(Function &)> AARGetter, Module &M) {
|
||||
std::string ModuleId = getUniqueModuleId(&M);
|
||||
if (ModuleId.empty()) {
|
||||
// We couldn't generate a module ID for this module, just write it out as a
|
||||
// regular LTO module.
|
||||
WriteBitcodeToFile(M, OS);
|
||||
// We couldn't generate a module ID for this module, write it out as a
|
||||
// regular LTO module with an index for summary-based dead stripping.
|
||||
ProfileSummaryInfo PSI(M);
|
||||
M.addModuleFlag(Module::Error, "ThinLTO", uint32_t(0));
|
||||
ModuleSummaryIndex Index = buildModuleSummaryIndex(M, nullptr, &PSI);
|
||||
WriteBitcodeToFile(M, OS, /*ShouldPreserveUseListOrder=*/false, &Index);
|
||||
|
||||
if (ThinLinkOS)
|
||||
// We don't have a ThinLTO part, but still write the module to the
|
||||
// ThinLinkOS if requested so that the expected output file is produced.
|
||||
WriteBitcodeToFile(M, *ThinLinkOS);
|
||||
WriteBitcodeToFile(M, *ThinLinkOS, /*ShouldPreserveUseListOrder=*/false,
|
||||
&Index);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
; copy of the regular module.
|
||||
; RUN: diff %t %t2
|
||||
|
||||
; BCA: <FULL_LTO_GLOBALVAL_SUMMARY_BLOCK
|
||||
; BCA-NOT: <GLOBALVAL_SUMMARY_BLOCK
|
||||
|
||||
; CHECK: @llvm.global_ctors = appending global
|
||||
@ -27,4 +28,7 @@ define void @h() comdat {
|
||||
ret void
|
||||
}
|
||||
|
||||
; CHECK: !llvm.module.flags = !{![[FLAG:[0-9]+]]}
|
||||
; CHECK: ![[FLAG]] = !{i32 1, !"ThinLTO", i32 0}
|
||||
|
||||
!0 = !{i32 0, !"typeid"}
|
||||
|
Loading…
x
Reference in New Issue
Block a user