[llvm] [ThinLTO] Simplify checking for single external copy (NFCI) (PR #164861)

Mingming Liu via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 23 12:56:48 PDT 2025


================
@@ -471,16 +471,14 @@ static void thinLTOInternalizeAndPromoteGUID(
     ValueInfo VI, function_ref<bool(StringRef, ValueInfo)> isExported,
     function_ref<bool(GlobalValue::GUID, const GlobalValueSummary *)>
         isPrevailing) {
-  auto ExternallyVisibleCopies =
-      llvm::count_if(VI.getSummaryList(),
-                     [](const std::unique_ptr<GlobalValueSummary> &Summary) {
-                       return !GlobalValue::isLocalLinkage(Summary->linkage());
-                     });
-
   // Before performing index-based internalization and promotion for this GUID,
   // the local flag should be consistent with the summary list linkage types.
   VI.verifyLocal();
 
+  bool SingleExternallyVisibleCopy =
----------------
mingmingl-llvm wrote:

Optional suggestion: make this `const bool` so it's clearer it doesn't get modified later.

https://github.com/llvm/llvm-project/pull/164861


More information about the llvm-commits mailing list