[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


================
@@ -1325,10 +1367,10 @@ bool DevirtModule::trySingleImplDevirt(
   if (!IsExported)
     return false;
 
-  // If the only implementation has local linkage, we must promote to external
-  // to make it visible to thin LTO objects. We can only get here during the
-  // ThinLTO export phase.
-  if (TheFn->hasLocalLinkage()) {
+  // Out of speculative devirtualization mode, if the only implementation has
+  // local linkage, we must promote to external to make it visible to thin LTO
+  // objects.
+  if (!DevirtSpeculatively && TheFn->hasLocalLinkage()) {
----------------
teresajohnson wrote:

That's full LTO. In that case no promotion should be needed, as full LTO merges everything into one module. This handling is for ThinLTO when we have hybrid ThinLTO/fullLTO (via LTO unit splitting), and the internal object in the full LTO object must be promoted to be exported to a ThinLTO object (hence the original comment "We can only get here during the ThinLTO export phase"). In that case we always have an ExportSummary (exports the full LTO analysis to the ThinLTO split modules). So I don't think we need to identify that we are in LTO. 

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


More information about the llvm-commits mailing list