[clang] [lld] [llvm] [ThinLTO] Reduce the number of renaming due to promotions (PR #178587)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 10 13:50:05 PST 2026
================
@@ -480,12 +481,19 @@ static void thinLTOInternalizeAndPromoteGUID(
VI.getSummaryList().size() == 1 &&
!GlobalValue::isLocalLinkage(VI.getSummaryList().front()->linkage());
+ bool NameInGlobals = false;
for (auto &S : VI.getSummaryList()) {
// First see if we need to promote an internal value because it is not
// exported.
if (isExported(S->modulePath(), VI)) {
- if (GlobalValue::isLocalLinkage(S->linkage()))
+ if (GlobalValue::isLocalLinkage(S->linkage())) {
S->setLinkage(GlobalValue::ExternalLinkage);
+ if (!NameInGlobals) {
+ if (Globals.insert(VI.name()).second)
+ S->setRenameOnPromotion(false);
+ NameInGlobals = true;
----------------
yonghong-song wrote:
I will put 'NamesInGlobals = true' before the 'if (Globals....)' condition. This will make logic more easy to understand. BTW, will also rename Globals to ExternallyVisibleSymbolNames.
https://github.com/llvm/llvm-project/pull/178587
More information about the cfe-commits
mailing list