[llvm] f11899f - [ThinLTO][WPD] Simplify check for local summary for efficiency (NFCI) (#164859)

via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 23 12:02:09 PDT 2025


Author: Teresa Johnson
Date: 2025-10-23T12:02:05-07:00
New Revision: f11899f6479cebe47bcdc2cf049fa8a47991ad46

URL: https://github.com/llvm/llvm-project/commit/f11899f6479cebe47bcdc2cf049fa8a47991ad46
DIFF: https://github.com/llvm/llvm-project/commit/f11899f6479cebe47bcdc2cf049fa8a47991ad46.diff

LOG: [ThinLTO][WPD] Simplify check for local summary for efficiency (NFCI) (#164859)

Use the new HasLocal flag to avoid looking through all summaries to see
if there is a local copy.

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
index 6909a282b3129..faae54ebcdc9b 100644
--- a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
+++ b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
@@ -1408,9 +1408,8 @@ bool DevirtIndex::trySingleImplDevirt(MutableArrayRef<ValueInfo> TargetsForSlot,
 
   // If the summary list contains multiple summaries where at least one is
   // a local, give up, as we won't know which (possibly promoted) name to use.
-  for (const auto &S : TheFn.getSummaryList())
-    if (GlobalValue::isLocalLinkage(S->linkage()) && Size > 1)
-      return false;
+  if (TheFn.hasLocal() && Size > 1)
+    return false;
 
   // Collect functions devirtualized at least for one call site for stats.
   if (PrintSummaryDevirt || AreStatisticsEnabled())


        


More information about the llvm-commits mailing list