[llvm] [AMDGPU] Emit the relocation symbol for LDS and named barrier when object linking is enabled (PR #192380)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 16 09:16:55 PDT 2026


================
@@ -8348,6 +8348,16 @@ bool SITargetLowering::shouldUseLDSConstAddress(const GlobalValue *GV) const {
   if (!GV->hasExternalLinkage())
     return true;
 
+  // With object linking, external LDS declarations need relocations so the
+  // linker can assign their offsets.
+  if (AMDGPUTargetMachine::EnableObjectLinking) {
+    if (const auto *GVar = dyn_cast<GlobalVariable>(GV)) {
+      if (GVar->isDeclaration() &&
+          GVar->getAddressSpace() == AMDGPUAS::LOCAL_ADDRESS)
----------------
shiltian wrote:

Yes, I think I need to make this an assertion as well.

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


More information about the llvm-commits mailing list