[all-commits] [llvm/llvm-project] 597335: [LTO/WPD] Enable aggressive WPD under LTO option

Teresa Johnson via All-commits all-commits at lists.llvm.org
Thu Jan 23 16:10:08 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 59733525d37cf9ad88b5021b33ecdbaf2e18911c
      https://github.com/llvm/llvm-project/commit/59733525d37cf9ad88b5021b33ecdbaf2e18911c
  Author: Teresa Johnson <tejohnson at google.com>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M clang/lib/CodeGen/BackendUtil.cpp
    M clang/lib/CodeGen/CGClass.cpp
    M clang/lib/CodeGen/CGVTables.cpp
    M clang/lib/CodeGen/CodeGenModule.h
    M clang/lib/CodeGen/ItaniumCXXABI.cpp
    M clang/test/CodeGen/thinlto-distributed-cfi-devirt.ll
    M clang/test/CodeGenCXX/cfi-mfcall.cpp
    M clang/test/CodeGenCXX/lto-visibility-inference.cpp
    A clang/test/CodeGenCXX/thinlto-distributed-type-metadata.cpp
    M clang/test/CodeGenCXX/type-metadata.cpp
    M lld/ELF/Config.h
    M lld/ELF/Driver.cpp
    M lld/ELF/LTO.cpp
    M lld/ELF/Options.td
    A lld/test/ELF/lto/devirt_vcall_vis_public.ll
    M llvm/include/llvm/LTO/Config.h
    M llvm/include/llvm/Transforms/IPO.h
    M llvm/include/llvm/Transforms/IPO/LowerTypeTests.h
    M llvm/include/llvm/Transforms/IPO/WholeProgramDevirt.h
    M llvm/lib/LTO/LTO.cpp
    M llvm/lib/LTO/LTOCodeGenerator.cpp
    M llvm/lib/LTO/ThinLTOCodeGenerator.cpp
    M llvm/lib/Transforms/IPO/LowerTypeTests.cpp
    M llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
    M llvm/test/ThinLTO/X86/cache-typeid-resolutions.ll
    M llvm/test/ThinLTO/X86/cfi-devirt.ll
    M llvm/test/ThinLTO/X86/devirt-after-icp.ll
    M llvm/test/ThinLTO/X86/devirt.ll
    M llvm/test/ThinLTO/X86/devirt2.ll
    M llvm/test/ThinLTO/X86/devirt_alias.ll
    M llvm/test/ThinLTO/X86/devirt_available_externally.ll
    M llvm/test/ThinLTO/X86/devirt_external_comdat_same_guid.ll
    M llvm/test/ThinLTO/X86/devirt_promote.ll
    M llvm/test/ThinLTO/X86/devirt_promote_legacy.ll
    M llvm/test/ThinLTO/X86/devirt_single_hybrid.ll
    A llvm/test/ThinLTO/X86/devirt_vcall_vis_hidden.ll
    A llvm/test/ThinLTO/X86/devirt_vcall_vis_public.ll
    M llvm/test/Transforms/WholeProgramDevirt/bad-read-from-vtable.ll
    M llvm/test/Transforms/WholeProgramDevirt/branch-funnel-threshold.ll
    M llvm/test/Transforms/WholeProgramDevirt/branch-funnel.ll
    M llvm/test/Transforms/WholeProgramDevirt/constant-arg.ll
    M llvm/test/Transforms/WholeProgramDevirt/devirt-single-impl-check.ll
    M llvm/test/Transforms/WholeProgramDevirt/devirt-single-impl.ll
    M llvm/test/Transforms/WholeProgramDevirt/expand-check.ll
    M llvm/test/Transforms/WholeProgramDevirt/export-nothing.ll
    M llvm/test/Transforms/WholeProgramDevirt/export-single-impl.ll
    M llvm/test/Transforms/WholeProgramDevirt/export-uniform-ret-val.ll
    M llvm/test/Transforms/WholeProgramDevirt/export-unique-ret-val.ll
    M llvm/test/Transforms/WholeProgramDevirt/export-unsuccessful-checked.ll
    M llvm/test/Transforms/WholeProgramDevirt/export-vcp.ll
    M llvm/test/Transforms/WholeProgramDevirt/non-constant-vtable.ll
    M llvm/test/Transforms/WholeProgramDevirt/pointer-vtable.ll
    M llvm/test/Transforms/WholeProgramDevirt/soa-vtable.ll
    M llvm/test/Transforms/WholeProgramDevirt/struct-vtable.ll
    M llvm/test/Transforms/WholeProgramDevirt/uniform-retval-invoke.ll
    M llvm/test/Transforms/WholeProgramDevirt/uniform-retval.ll
    M llvm/test/Transforms/WholeProgramDevirt/unique-retval.ll
    M llvm/test/Transforms/WholeProgramDevirt/vcp-accesses-memory.ll
    M llvm/test/Transforms/WholeProgramDevirt/vcp-decl.ll
    M llvm/test/Transforms/WholeProgramDevirt/vcp-no-this.ll
    M llvm/test/Transforms/WholeProgramDevirt/vcp-non-constant-arg.ll
    M llvm/test/Transforms/WholeProgramDevirt/vcp-too-wide-ints.ll
    M llvm/test/Transforms/WholeProgramDevirt/vcp-type-mismatch.ll
    M llvm/test/Transforms/WholeProgramDevirt/vcp-uses-this.ll
    M llvm/test/Transforms/WholeProgramDevirt/virtual-const-prop-begin.ll
    M llvm/test/Transforms/WholeProgramDevirt/virtual-const-prop-check.ll
    M llvm/test/Transforms/WholeProgramDevirt/virtual-const-prop-end.ll
    M llvm/test/Transforms/WholeProgramDevirt/vtable-decl.ll
    A llvm/test/tools/gold/X86/devirt_vcall_vis_public.ll
    M llvm/tools/gold/gold-plugin.cpp
    M llvm/tools/opt/opt.cpp

  Log Message:
  -----------
  [LTO/WPD] Enable aggressive WPD under LTO option

Summary:
Third part in series to support Safe Whole Program Devirtualization
Enablement, see RFC here:
http://lists.llvm.org/pipermail/llvm-dev/2019-December/137543.html

This patch adds type test metadata under -fwhole-program-vtables,
even for classes without hidden visibility. It then changes WPD to skip
devirtualization for a virtual function call when any of the compatible
vtables has public vcall visibility.

Additionally, internal LLVM options as well as lld and gold-plugin
options are added which enable upgrading all public vcall visibility
to linkage unit (hidden) visibility during LTO. This enables the more
aggressive WPD to kick in based on LTO time knowledge of the visibility
guarantees.

Support was added to all flavors of LTO WPD (regular, hybrid and
index-only), and to both the new and old LTO APIs.

Unfortunately it was not simple to split the first and second parts of
this part of the change (the unconditional emission of type tests and
the upgrading of the vcall visiblity) as I needed a way to upgrade the
public visibility on legacy WPD llvm assembly tests that don't include
linkage unit vcall visibility specifiers, to avoid a lot of test churn.

I also added a mechanism to LowerTypeTests that allows dropping type
test assume sequences we now aggressively insert when we invoke
distributed ThinLTO backends with null indexes, which is used in testing
mode, and which doesn't invoke the normal ThinLTO backend pipeline.

Depends on D71907 and D71911.

Reviewers: pcc, evgeny777, steven_wu, espindola

Subscribers: emaste, Prazek, inglorion, arichardson, hiraditya, MaskRay, dexonsmith, dang, davidxl, cfe-commits, llvm-commits

Tags: #clang, #llvm

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




More information about the All-commits mailing list