[llvm] dd3f483 - [ThinLTO][WPD] LICM set lookup (NFC)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 10 13:16:52 PST 2022


Author: Teresa Johnson
Date: 2022-02-10T13:16:31-08:00
New Revision: dd3f48333538902140018f1d7ba7c1829ea3ba6b

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

LOG: [ThinLTO][WPD] LICM set lookup (NFC)

Minor efficiency fix. There is no reason to perform the same set lookup
repeatedly in the inner loop as it is invariant there.

Differential Revision: https://reviews.llvm.org/D119474

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 8b30f0e989a1..fab080f3e133 100644
--- a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
+++ b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
@@ -866,13 +866,14 @@ void updateVCallVisibilityInIndex(
   if (!hasWholeProgramVisibility(WholeProgramVisibilityEnabledInLTO))
     return;
   for (auto &P : Index) {
+    // Don't upgrade the visibility for symbols exported to the dynamic
+    // linker, as we have no information on their eventual use.
+    if (DynamicExportSymbols.count(P.first))
+      continue;
     for (auto &S : P.second.SummaryList) {
       auto *GVar = dyn_cast<GlobalVarSummary>(S.get());
       if (!GVar ||
-          GVar->getVCallVisibility() != GlobalObject::VCallVisibilityPublic ||
-          // Don't upgrade the visibility for symbols exported to the dynamic
-          // linker, as we have no information on their eventual use.
-          DynamicExportSymbols.count(P.first))
+          GVar->getVCallVisibility() != GlobalObject::VCallVisibilityPublic)
         continue;
       GVar->setVCallVisibility(GlobalObject::VCallVisibilityLinkageUnit);
     }


        


More information about the llvm-commits mailing list