[llvm] [AMDGPU][GlobalISel] Scale M0/GPR indirect index by element size (PR #216698)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 17 06:04:19 PDT 2026


================
@@ -3411,6 +3411,23 @@ computeIndirectRegIndex(MachineRegisterInfo &MRI, const SIRegisterInfo &TRI,
   return std::pair(IdxBaseReg, SubRegs[Offset]);
 }
 
+/// M0/GPR-index addressing counts 32-bit registers, not EltSize-byte elements.
+static Register scaleIndirectIdxReg(MachineRegisterInfo &MRI,
+                                    const SIInstrInfo &TII,
+                                    MachineBasicBlock &BB, MachineInstr &I,
+                                    const DebugLoc &DL, Register IdxReg,
+                                    unsigned EltSize) {
+  if (EltSize <= 4)
----------------
arsenm wrote:

Wouldn't this need to be exactly 4? You can rely on only seeing legally typed operations 

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


More information about the llvm-commits mailing list