Skip to content

Conversation

@teresajohnson
Copy link
Contributor

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

Use the new HasLocal flag to avoid looking through all summaries to see
if there is a local copy.
@llvmbot
Copy link
Member

llvmbot commented Oct 23, 2025

@llvm/pr-subscribers-llvm-transforms

Author: Teresa Johnson (teresajohnson)

Changes

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


Full diff: https://github.com/llvm/llvm-project/pull/164859.diff

1 Files Affected:

  • (modified) llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp (+2-3)
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())

@teresajohnson teresajohnson merged commit f11899f into llvm:main Oct 23, 2025
10 of 11 checks passed
dvbuka pushed a commit to dvbuka/llvm-project that referenced this pull request Oct 27, 2025
…llvm#164859)

Use the new HasLocal flag to avoid looking through all summaries to see
if there is a local copy.
Lukacma pushed a commit to Lukacma/llvm-project that referenced this pull request Oct 29, 2025
…llvm#164859)

Use the new HasLocal flag to avoid looking through all summaries to see
if there is a local copy.
aokblast pushed a commit to aokblast/llvm-project that referenced this pull request Oct 30, 2025
…llvm#164859)

Use the new HasLocal flag to avoid looking through all summaries to see
if there is a local copy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants