[all-commits] [llvm/llvm-project] 3c4c20: [WPD][lld] Test handling of vtable definition from...

Teresa Johnson via All-commits all-commits at lists.llvm.org
Wed Feb 17 12:49:53 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3c4c205060c9398da705eb71b63ddd8a04999de9
      https://github.com/llvm/llvm-project/commit/3c4c205060c9398da705eb71b63ddd8a04999de9
  Author: Teresa Johnson <tejohnson at google.com>
  Date:   2021-02-17 (Wed, 17 Feb 2021)

  Changed paths:
    A lld/test/ELF/lto/Inputs/devirt_vcall_vis_shared_def.ll
    A lld/test/ELF/lto/devirt_vcall_vis_shared_def.ll
    M llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
    M llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp

  Log Message:
  -----------
  [WPD][lld] Test handling of vtable definition from shared libraries

Adds a lld test for a case that the handling added for dynamically
exported symbols in 1487747e990ce9f8851f3d92c3006a74134d7518 already
fixes. Because isExportDynamic returns true when the symbol is
SharedKind with default visibility, it will treat as dynamically
exported and block devirtualization when the definition of a vtable
comes from a shared library. This is desireable as it is dangerous to
devirtualize in that case, since there could be hidden overrides in the
shared library. Typically that happens when the shared library header
contains available externally definitions, which applications can
override. An example is std::error_category, which is overridden in LLVM
and causing failures after a self build with WPD enabled, because
libstdc++ contains hidden overrides of the virtual base class methods.

The regular LTO case in the new test already worked, but there are
2 fixes in this patch needed for the index-only case and the hybrid
LTO case. For the index-only case, WPD should not simply ignore
available externally vtables. A follow on fix will be made to clang to
emit type metadata for those vtables, which the new test is modeling.
For the hybrid case, we need to ensure when the module is split that any
llvm.*used globals are cloned to the regular LTO split module so
available externally vtable definitions are not prematurely deleted.

Another follow on fix will add the equivalent gold test, which requires
a small fix to the plugin to treat symbols in dynamic libraries the same
way lld already is.

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




More information about the All-commits mailing list