[llvm] a909ec6 - [ThinLTO][WPD] LICM a loop invariant check (#164862)

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


Author: Teresa Johnson
Date: 2025-10-23T12:02:27-07:00
New Revision: a909ec64dc36ba26f103b9f1bd71dd4b9c73ed5f

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

LOG: [ThinLTO][WPD] LICM a loop invariant check (#164862)

Move a loop invariant check out of the innermost loop. I measured a
small but consistent thin link speedup from this change for a large
target (0.75%).

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 faae54ebcdc9b..2dd0fde6b34d6 100644
--- a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
+++ b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
@@ -948,17 +948,17 @@ void llvm::updateVCallVisibilityInIndex(
     // linker, as we have no information on their eventual use.
     if (DynamicExportSymbols.count(P.first))
       continue;
+    // With validation enabled, we want to exclude symbols visible to regular
+    // objects. Local symbols will be in this group due to the current
+    // implementation but those with VCallVisibilityTranslationUnit will have
+    // already been marked in clang so are unaffected.
+    if (VisibleToRegularObjSymbols.count(P.first))
+      continue;
     for (auto &S : P.second.getSummaryList()) {
       auto *GVar = dyn_cast<GlobalVarSummary>(S.get());
       if (!GVar ||
           GVar->getVCallVisibility() != GlobalObject::VCallVisibilityPublic)
         continue;
-      // With validation enabled, we want to exclude symbols visible to regular
-      // objects. Local symbols will be in this group due to the current
-      // implementation but those with VCallVisibilityTranslationUnit will have
-      // already been marked in clang so are unaffected.
-      if (VisibleToRegularObjSymbols.count(P.first))
-        continue;
       GVar->setVCallVisibility(GlobalObject::VCallVisibilityLinkageUnit);
     }
   }


        


More information about the llvm-commits mailing list