[llvm] [AMDGPU] Lower loads and stores for address space 13 (PR #209541)

Gheorghe-Teodor Bercea via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 5 22:05:06 PDT 2026


================
@@ -379,6 +385,83 @@ bool AMDGPULowerVGPREncoding::runOnMachineInstr(MachineInstr &MI) {
   return false;
 }
 
+void AMDGPULowerVGPREncoding::lowerLoadStoreIdx(MachineInstr &MI) {
+  auto &LdSt = cast<AMDGPUMI::VLoadStoreIdxInst>(MI);
+  MachineBasicBlock &BB = *MI.getParent();
+  const DebugLoc &DL = MI.getDebugLoc();
+  const bool IsStore = LdSt.mayStore();
+
+  Register Data = LdSt.getDataOp().getReg();
+  unsigned Offset = LdSt.getOffsetOp().getImm();
+  unsigned NumDwords = LdSt.getBitWidth() / 32;
+
+  // A statically out-of-range offset is undefined behavior; mask it into the
+  // addressable range below rather than emit an invalid register. The AGPRs
+  // that gfx90a+ counts as addressable cannot be named as VGPRs.
+  unsigned DynamicVGPRBlockSize =
+      MI.getMF()->getInfo<SIMachineFunctionInfo>()->getDynamicVGPRBlockSize();
----------------
doru1004 wrote:

Done

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


More information about the llvm-commits mailing list