[clang] [llvm] [WPD] Support speculative devirtualization with LTO (PR #233380)

via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 22 02:05:22 PDT 2026


================
@@ -1131,12 +1120,6 @@ bool DevirtModule::tryFindVirtualCallTargets(
     if (Fn->getName() == "__cxa_pure_virtual")
       continue;
 
-    // In most cases empty functions will be overridden by the
-    // implementation of the derived class, so we can skip them.
-    if (DevirtSpeculatively && Fn->getReturnType()->isVoidTy() &&
----------------
KRM7 wrote:

I agree that this could be implemented, and that we would want to have the check, but I don't think that this is the right part of the code to include profitability checks, and the equivalent wouldn't really work for the thin-lto path, since I don't think that the function summaries include the function types.

I'm planning to have 2 follow up PRs after this one, one for supporting multiple targets for speculative devirtualization, and another for adding some basic profitability checks/cost model for speculative devirtualization.
I think it would just be simpler to deal with this in the later PR dealing with profitability in general.

https://github.com/llvm/llvm-project/pull/233380


More information about the cfe-commits mailing list