[ThinLTO/WPD] Fix index-based WPD for alias vtables
authorTeresa Johnson <tejohnson@google.com>
Thu, 5 Dec 2019 01:15:10 +0000 (17:15 -0800)
committerTeresa Johnson <tejohnson@google.com>
Mon, 13 Jan 2020 21:38:26 +0000 (13:38 -0800)
commit31441a3e007833a180b0112550eddb78547771f2
treedc691b2b8279d6dacd6891d3668a892ee5d565dd
parent810b28edb3f64569054d49d6ddf18a4d802d9b11
[ThinLTO/WPD] Fix index-based WPD for alias vtables

Summary:
A recent fix in D69452 fixed index based WPD in the presence of
available_externally vtables. It added a cast of the vtable def
summary to a GlobalVarSummary. However, in some cases one def may be an
alias, in which case we need to get the base object before casting,
otherwise we will crash.

Reviewers: evgeny777, steven_wu, aganea

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

Tags: #llvm

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