OSDN Git Service

[LowerTypeTests] Limit when icall jumptable entries are emitted
authorVlad Tsyrklevich <vlad@tsyrklevich.net>
Fri, 13 Jul 2018 19:57:39 +0000 (19:57 +0000)
committerVlad Tsyrklevich <vlad@tsyrklevich.net>
Fri, 13 Jul 2018 19:57:39 +0000 (19:57 +0000)
commit7dc602e516439662899798930dbafe3cfac52774
tree796046f42c57d50474d7f47b8bf8af6430a32969
parent6ab694dd51ed0103163d44c24cfb645b1dbe9199
[LowerTypeTests] Limit when icall jumptable entries are emitted

Summary:
Currently LowerTypeTests emits jumptable entries for all live external
and address-taken functions; however, we could limit the number of
functions that we emit entries for significantly.

For Cross-DSO CFI, we continue to emit jumptable entries for all
exported definitions.  In the non-Cross-DSO CFI case, we only need to
emit jumptable entries for live functions that are address-taken in live
functions. This ignores exported functions and functions that are only
address taken in dead functions. This change uses ThinLTO summary data
(now emitted for all modules during ThinLTO builds) to determine
address-taken and liveness info.

The logic for emitting jumptable entries is more conservative in the
regular LTO case because we don't have summary data in the case of
monolithic LTO builds; however, once summaries are emitted for all LTO
builds we can unify the Thin/monolithic LTO logic to only use summaries
to determine the liveness of address taking functions.

This change is a partial fix for PR37474. It reduces the build size for
nacl_helper by ~2-3%, the reduction is due to nacl_helper compiling in
lots of unused code and unused functions that are address taken in dead
functions no longer being being considered live due to emitted jumptable
references. The reduction for chromium is ~0.1-0.2%.

Reviewers: pcc, eugenis, javed.absar

Reviewed By: pcc

Subscribers: aheejin, dexonsmith, dschuff, mehdi_amini, eraman, steven_wu, llvm-commits, kcc

Differential Revision: https://reviews.llvm.org/D47652

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337038 91177308-0d34-0410-b5e6-96231b3b80d8
13 files changed:
include/llvm/IR/ModuleSummaryIndexYAML.h
lib/Transforms/IPO/LowerTypeTests.cpp
test/LTO/Resolution/X86/export-jumptable.ll
test/ThinLTO/X86/cfi-icall.ll
test/Transforms/LowerTypeTests/Inputs/export-icall.yaml [new file with mode: 0644]
test/Transforms/LowerTypeTests/Inputs/exported-funcs.yaml [new file with mode: 0644]
test/Transforms/LowerTypeTests/export-alias.ll
test/Transforms/LowerTypeTests/export-cross-dso-cfi.ll [new file with mode: 0644]
test/Transforms/LowerTypeTests/export-icall.ll
test/Transforms/LowerTypeTests/export-symver.ll
test/Transforms/LowerTypeTests/function-arm-thumb.ll
test/Transforms/LowerTypeTests/function-ext.ll
test/Transforms/LowerTypeTests/pr37625.ll