[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:12:03 PDT 2026
================
@@ -330,10 +331,18 @@ void AMDGPUAsmPrinter::emitGlobalVariable(const GlobalVariable *GV) {
return;
}
- // LDS variables aren't emitted in HSA or PAL yet.
const Triple::OSType OS = TM.getTargetTriple().getOS();
- if (OS == Triple::AMDHSA || OS == Triple::AMDPAL)
- return;
+ if (OS == Triple::AMDHSA || OS == Triple::AMDPAL) {
+ if (!AMDGPUTargetMachine::EnableObjectLinking)
+ return;
+ // With object linking, LDS definitions should have been externalized
+ // by earlier passes (e.g. LDS lowering, named barrier lowering).
+ // Only declarations reach here, emitted as SHN_AMDGPU_LDS symbols
+ // so the linker can assign their offsets.
+ assert(GV->isDeclaration() &&
+ "LDS definitions should have been externalized when object "
+ "linking is enabled");
----------------
shiltian wrote:
This needs to be an assertion, because this should not really happen. If that happens, there must be something wrong in the pipeline.
https://github.com/llvm/llvm-project/pull/192380
More information about the llvm-commits
mailing list