[llvm] [WPD]: Enable speculative devirtualizatoin. (PR #159048)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 1 10:35:14 PDT 2025


================
@@ -2472,8 +2512,11 @@ bool DevirtModule::run() {
                  .WPDRes[S.first.ByteOffset];
     if (tryFindVirtualCallTargets(TargetsForSlot, TypeMemberInfos,
                                   S.first.ByteOffset, ExportSummary)) {
-
-      if (!trySingleImplDevirt(ExportSummary, TargetsForSlot, S.second, Res)) {
+      bool SingleImplDevirt =
+          trySingleImplDevirt(ExportSummary, TargetsForSlot, S.second, Res);
+      // Out of speculative devirtualization mode, Try to apply virtual constant
+      // propagation or branch funneling.
----------------
teresajohnson wrote:

Can you add a TODO that these optimizations should eventually be allowed on calls from non-public type tests?

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


More information about the llvm-commits mailing list