[llvm] [NFC][SPIRV] Use hasLocalLinkage instead of hasInternalLinkage or hasPrivateLinkage (PR #164236)

Juan Manuel Martinez CaamaƱo via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 20 04:36:07 PDT 2025


https://github.com/jmmartinez created https://github.com/llvm/llvm-project/pull/164236

Internally, hasLocalLinkage is implemented as:
```cpp
static bool isLocalLinkage(LinkageTypes Linkage) {
  return isInternalLinkage(Linkage) || isPrivateLinkage(Linkage);
}
```

>From 62121a3eaca7ae34f6843a9dc7ef2ece2a531dfd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Juan=20Manuel=20Martinez=20Caama=C3=B1o?= <juamarti at amd.com>
Date: Mon, 20 Oct 2025 13:31:24 +0200
Subject: [PATCH] [NFC][SPIRV] Use hasLocalLinkage instead of
 hasInternalLinkage or hasPrivateLinkage

---
 llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp b/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
index a0cff4d82b500..0b80b25307cae 100644
--- a/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
@@ -4350,7 +4350,7 @@ bool SPIRVInstructionSelector::selectGlobalValue(
   if (hasInitializer(GlobalVar) && !Init)
     return true;
 
-  bool HasLnkTy = !GV->hasInternalLinkage() && !GV->hasPrivateLinkage() &&
+  bool HasLnkTy = !GV->hasLocalLinkage() &&
                   !GV->hasHiddenVisibility();
   SPIRV::LinkageType::LinkageType LnkType =
       GV->isDeclarationForLinker()



More information about the llvm-commits mailing list