[all-commits] [llvm/llvm-project] 0a5949: [WPD] Fix handling of pure virtual base class
Teresa Johnson via All-commits
all-commits at lists.llvm.org
Tue Feb 23 16:07:41 PST 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 0a5949dcfa31d599353fb4ccf4d207bdae7c7281
https://github.com/llvm/llvm-project/commit/0a5949dcfa31d599353fb4ccf4d207bdae7c7281
Author: Teresa Johnson <tejohnson at google.com>
Date: 2021-02-23 (Tue, 23 Feb 2021)
Changed paths:
M llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
A llvm/test/ThinLTO/X86/devirt_pure_virtual_base.ll
Log Message:
-----------
[WPD] Fix handling of pure virtual base class
The fix in 3c4c205060c9398da705eb71b63ddd8a04999de9 caused an assert in
the case of a pure virtual base class. In that case, the vTableFuncs
list on the summary will be empty, so we were hitting the new assert
that the linkage type was not available_externally.
In the case of pure virtual, we do not want to assert, and additionally
need to set VS so that we don't treat it conservatively and quit the
analysis of the type id early.
This exposed a pre-existing issue where we were not updating the vcall
visibility on pure virtual functions when whole program visibility was
specified. We were skipping updating the visibility on any global vars
that didn't have any vTableFuncs, which meant all pure virtual were not
updated, and the later analysis would block any devirtualization of
calls that had a type id used on those pure virtual vtables (see the
handling in the other code modified in this patch). Simply remove that
check. It will mean that we may update the vcall visibility on global
vars that aren't vtables, but that setting is ignored for any global
vars that didn't have type metadata anyway.
Added a new test case that asserted without removing the assert, and
that requires the other fixes in this patch (updateVCallVisibilityInIndex
and not skipping all vtables without virtual funcs) to get a successful
devirtualization with index-only WPD. I added cases to test hybrid and
regular LTO for completeness, although those already worked without the
fixes here.
With this final fix, a clang multistage bootstrap with WPD builds and
runs all tests successfully.
Differential Revision: https://reviews.llvm.org/D97126
More information about the All-commits
mailing list