[llvm] [WholeProgramDevirt] Add check for AvailableExternal and give up devirt (PR #143468)
Tianle Liu via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 10 19:07:22 PDT 2025
================
@@ -1103,6 +1104,16 @@ bool DevirtModule::tryFindVirtualCallTargets(
GlobalObject::VCallVisibilityPublic)
return false;
+ // Record if the first GV is AvailableExternally
+ if (TargetsForSlot.empty())
+ hasAvailableExternally = TM.Bits->GV->hasAvailableExternallyLinkage();
+
+ // When the first GV is AvailableExternally, check if all other GVs are
----------------
tianleliu wrote:
This is a conservative checking that does not stop devirtualization for all available externally.
Because when doing the check of available externally, checking of VCallVisibility != VCallVisibilityPublic is pass, which means all virtual function calls from this available externally vtable are in the current LTO unit. So I guess a icall.branch.funnel whose parameters all relate to available externally vtable is allowed to generated?
https://github.com/llvm/llvm-project/pull/143468
More information about the llvm-commits
mailing list