[llvm] [AMDGPU] Fold constant offsets into named barrier addresses (PR #205216)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 1 03:28:07 PDT 2026


================
@@ -1553,7 +1553,10 @@ SDValue AMDGPUTargetLowering::LowerGlobalAddress(AMDGPUMachineFunctionInfo *MFI,
         unsigned BarCnt = cast<GlobalVariable>(GV)->getGlobalSize(DL) / 16;
         MFI->recordNumNamedBarriers(Address.value(), BarCnt);
       }
-      return DAG.getConstant(*Address, SDLoc(Op), Op.getValueType());
+      // A constant byte offset (e.g. from a GEP into an array of named
+      // barriers) folds directly into the fixed LDS address.
+      return DAG.getConstant(*Address + G->getOffset(), SDLoc(Op),
+                             Op.getValueType());
     } else if (IsNamedBarrier) {
----------------
arsenm wrote:

No else after return 

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


More information about the llvm-commits mailing list