llvm-project/llvm/test/Transforms/GlobalDCE
Teresa Johnson 458676db6e [WPD/VFE] Always emit vcall_visibility metadata for -fwhole-program-vtables
Summary:
First patch to support Safe Whole Program Devirtualization Enablement,
see RFC here: http://lists.llvm.org/pipermail/llvm-dev/2019-December/137543.html

Always emit !vcall_visibility metadata under -fwhole-program-vtables,
and not just for -fvirtual-function-elimination. The vcall visibility
metadata will (in a subsequent patch) be used to communicate to WPD
which vtables are safe to devirtualize, and we will optionally convert
the metadata to hidden visibility at link time. Subsequent follow on
patches will help enable this by adding vcall_visibility metadata to the
ThinLTO summaries, and always emit type test intrinsics under
-fwhole-program-vtables (and not just for vtables with hidden
visibility).

In order to do this safely with VFE, since for VFE all vtable loads must
be type checked loads which will no longer be the case, this patch adds
a new "Virtual Function Elim" module flag to communicate to GlobalDCE
whether to perform VFE using the vcall_visibility metadata.

One additional advantage of using the vcall_visibility metadata to drive
more WPD at LTO link time is that we can use the same mechanism to
enable more aggressive VFE at LTO link time as well. The link time
option proposed in the RFC will convert vcall_visibility metadata to
hidden (aka linkage unit visibility), which combined with
-fvirtual-function-elimination will allow it to be done more
aggressively at LTO link time under the same conditions.

Reviewers: pcc, ostannard, evgeny777, steven_wu

Subscribers: mehdi_amini, Prazek, hiraditya, dexonsmith, davidxl, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D71907
2020-01-23 11:36:01 -08:00
..
2002-07-17-CastRef.ll
2002-07-17-ConstantRef.ll
2002-08-17-FunctionDGE.ll
2002-08-17-WorkListTest.ll
2002-09-12-Redeletion.ll
2003-07-01-SelfReference.ll
2003-10-09-PreserveWeakGlobals.ll
2009-01-05-DeadAliases.ll
2009-02-17-AliasUsesAliasee.ll
basicvariabletest.ll
comdats.ll
complex-constantexpr.ll
crash-assertingvh.ll
deadblockaddr.ll
externally_available.ll
global-ifunc.ll
global_ctors.ll
global_ctors_integration.ll
indirectbr.ll
virtual-functions-base-call.ll [WPD/VFE] Always emit vcall_visibility metadata for -fwhole-program-vtables 2020-01-23 11:36:01 -08:00
virtual-functions-base-pointer-call.ll [WPD/VFE] Always emit vcall_visibility metadata for -fwhole-program-vtables 2020-01-23 11:36:01 -08:00
virtual-functions-derived-call.ll [WPD/VFE] Always emit vcall_visibility metadata for -fwhole-program-vtables 2020-01-23 11:36:01 -08:00
virtual-functions-derived-pointer-call.ll [WPD/VFE] Always emit vcall_visibility metadata for -fwhole-program-vtables 2020-01-23 11:36:01 -08:00
virtual-functions-novfe.ll [WPD/VFE] Always emit vcall_visibility metadata for -fwhole-program-vtables 2020-01-23 11:36:01 -08:00
virtual-functions-visibility-post-lto.ll [WPD/VFE] Always emit vcall_visibility metadata for -fwhole-program-vtables 2020-01-23 11:36:01 -08:00
virtual-functions-visibility-pre-lto.ll [WPD/VFE] Always emit vcall_visibility metadata for -fwhole-program-vtables 2020-01-23 11:36:01 -08:00
virtual-functions.ll [WPD/VFE] Always emit vcall_visibility metadata for -fwhole-program-vtables 2020-01-23 11:36:01 -08:00
vtable-rtti.ll [WPD/VFE] Always emit vcall_visibility metadata for -fwhole-program-vtables 2020-01-23 11:36:01 -08:00