[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 18:51:17 PDT 2025
tianleliu wrote:
> Rather than completely shut off devirtualization, would it be better to simply suppress using a branch funnel? I.e. check the GV linkage types of the recorded target GVs in DevirtModule::tryICallBranchFunnel.
Hi @teresajohnson Thanks for your review!
The reason I don't add the checking in tryICallBranchFunnel but tryFindVirtualCallTargets is to follow the code construction and save optimizing time. Checks in tryFindVirtualCallTargets mainly refers to basic checking without looking into target functions internal.
If my understand is right, result of checking in tryICallBranchFunnel or tryFindVirtualCallTargets are the same. If tryFindVirtualCallTargets returns true, it would run trySingleImplDevirt, tryVirtualConstProp or tryICallBranchFunnel in turn. Both trySingleImplDevirt and tryVirtualConstProp who merges/combines VirtualCallTargets functions need to know all definition of the functions. But functions referred in available externally GV are all declaration (They are defined in external libs). So trySingleImplDevirt or tryVirtualConstProp would not work and tryICallBranchFunnel would run.
https://github.com/llvm/llvm-project/pull/143468
More information about the llvm-commits
mailing list