llvm-project/llvm/test/Transforms/WholeProgramDevirt
Peter Collingbourne 2974856ad4 Use branch funnels for virtual calls when retpoline mitigation is enabled.
The retpoline mitigation for variant 2 of CVE-2017-5715 inhibits the
branch predictor, and as a result it can lead to a measurable loss of
performance. We can reduce the performance impact of retpolined virtual
calls by replacing them with a special construct known as a branch
funnel, which is an instruction sequence that implements virtual calls
to a set of known targets using a binary tree of direct branches. This
allows the processor to speculately execute valid implementations of the
virtual function without allowing for speculative execution of of calls
to arbitrary addresses.

This patch extends the whole-program devirtualization pass to replace
certain virtual calls with calls to branch funnels, which are
represented using a new llvm.icall.jumptable intrinsic. It also extends
the LowerTypeTests pass to recognize the new intrinsic, generate code
for the branch funnels (x86_64 only for now) and lay out virtual tables
as required for each branch funnel.

The implementation supports full LTO as well as ThinLTO, and extends the
ThinLTO summary format used for whole-program devirtualization to
support branch funnels.

For more details see RFC:
http://lists.llvm.org/pipermail/llvm-dev/2018-January/120672.html

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

llvm-svn: 327163
2018-03-09 19:11:44 +00:00
..
Inputs Use branch funnels for virtual calls when retpoline mitigation is enabled. 2018-03-09 19:11:44 +00:00
bad-read-from-vtable.ll
branch-funnel.ll Use branch funnels for virtual calls when retpoline mitigation is enabled. 2018-03-09 19:11:44 +00:00
constant-arg.ll
devirt-single-impl-check.ll
devirt-single-impl.ll
expand-check.ll
export-nothing.ll
export-single-impl.ll Make GlobalValues with non-default visibilility dso_local. 2018-01-18 02:08:23 +00:00
export-uniform-ret-val.ll LowerTypeTests: Add import/export support for targets without absolute symbol constants. 2017-09-11 22:49:10 +00:00
export-unique-ret-val.ll LowerTypeTests: Add import/export support for targets without absolute symbol constants. 2017-09-11 22:49:10 +00:00
export-unsuccessful-checked.ll
export-vcp.ll LowerTypeTests: Add import/export support for targets without absolute symbol constants. 2017-09-11 22:49:10 +00:00
import-indir.ll [LTO][ThinLTO] Use the linker resolutions to mark global values as dso_local. 2017-11-04 17:04:39 +00:00
import-no-dominating-assume.ll WholeProgramDevirt: Create bitcast to i8* at each virtual call site. 2017-08-22 21:41:19 +00:00
import.ll Use branch funnels for virtual calls when retpoline mitigation is enabled. 2018-03-09 19:11:44 +00:00
non-constant-vtable.ll
pointer-vtable.ll
soa-vtable.ll
struct-vtable.ll
uniform-retval-invoke.ll
uniform-retval.ll
unique-retval.ll WholeProgramDevirt: Create bitcast to i8* at each virtual call site. 2017-08-22 21:41:19 +00:00
vcp-accesses-memory.ll
vcp-decl.ll
vcp-no-this.ll
vcp-non-constant-arg.ll
vcp-too-wide-ints.ll
vcp-type-mismatch.ll
vcp-uses-this.ll
virtual-const-prop-begin.ll WholeProgramDevirt: Create bitcast to i8* at each virtual call site. 2017-08-22 21:41:19 +00:00
virtual-const-prop-check.ll
virtual-const-prop-end.ll WholeProgramDevirt: Create bitcast to i8* at each virtual call site. 2017-08-22 21:41:19 +00:00