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

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 25 12:50:52 PDT 2025


================
@@ -2350,6 +2392,11 @@ bool DevirtModule::run() {
 
   Function *TypeTestFunc =
       Intrinsic::getDeclarationIfExists(&M, Intrinsic::type_test);
+  // If we are in speculative devirtualization mode, we can work on the public
+  // type test intrinsics.
+  if (!TypeTestFunc && DevirtSpeculatively)
----------------
teresajohnson wrote:

Note that we can actually have a mix of public and non-public type tests, depending on the original vtable visibility. Maybe add a TODO here to support that case? As written if there were hidden visibility vtables in the module, we will have a non-public type test, and would not do speculative devirtualization for any public type tests for non-hidden vtables. 

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


More information about the llvm-commits mailing list