[PATCH] D119474: [ThinLTO][WPD] LICM set lookup (NFC)

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 10 12:43:35 PST 2022


tejohnson created this revision.
tejohnson added a reviewer: luna.
Herald added subscribers: ormris, hiraditya, inglorion.
tejohnson requested review of this revision.
Herald added a project: LLVM.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119474

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


Index: llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
===================================================================
--- llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
+++ llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
@@ -866,13 +866,14 @@
   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);
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119474.407647.patch
Type: text/x-patch
Size: 1136 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220210/e41cb1cd/attachment.bin>


More information about the llvm-commits mailing list