[ThinLTO/WPD] Fix index-based WPD for available_externally vtables
authorTeresa Johnson <tejohnson@google.com>
Fri, 25 Oct 2019 21:56:12 +0000 (14:56 -0700)
committerTeresa Johnson <tejohnson@google.com>
Thu, 31 Oct 2019 00:59:08 +0000 (17:59 -0700)
commitc844f8846aabda577a8bf3b460d4993e89475218
treee340b8812965ece88b9274807af375a7f4434142
parent58e66f2f6375dd3c63f5854abd908298a73851d9
[ThinLTO/WPD] Fix index-based WPD for available_externally vtables

Summary:
Clang does not add type metadata to available_externally vtables. When
choosing a summary to look at for virtual function definitions, make
sure we skip summaries for any available externally vtables as they will
not describe any virtual function functions, which are only summarized
in the presence of type metadata on the vtable def. Simply look for the
corresponding strong def's summary.

Also add handling for same-named local vtables with the same GUID
because of same-named files without enough distinguishing path.
In that case we return a conservative result with no devirtualization.

Reviewers: pcc, davidxl, evgeny777

Subscribers: mehdi_amini, inglorion, hiraditya, steven_wu, dexonsmith, arphaman, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D69452
llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
llvm/test/ThinLTO/X86/Inputs/devirt_available_externally.ll [new file with mode: 0644]
llvm/test/ThinLTO/X86/Inputs/devirt_local_same_guid.ll [new file with mode: 0644]
llvm/test/ThinLTO/X86/devirt_available_externally.ll [new file with mode: 0644]
llvm/test/ThinLTO/X86/devirt_local_same_guid.ll [new file with mode: 0644]