AMDGPU: Fix splitting SMRD with large offset
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Mon, 28 Sep 2015 20:54:42 +0000 (20:54 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Mon, 28 Sep 2015 20:54:42 +0000 (20:54 +0000)
The splitting of > 4 dword SMRD instructions
if using an offset in an SGPR instead of an immediate
was not setting the destination register,
resulting an an instruction missing an operand
which would assert later.

Test will be included in a following commit
which fixes a related issue.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248739 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/AMDGPU/SIInstrInfo.cpp

index 8fd065d95abcb0b0c227cce75cbcc1ec540ae578..9419afebd26e5dacb1fd32d1aca0e836b4f0147e 100644 (file)
@@ -2033,7 +2033,7 @@ void SIInstrInfo::splitSMRD(MachineInstr *MI,
     BuildMI(*MBB, MI, DL, get(AMDGPU::S_ADD_I32), OffsetSGPR)
             .addOperand(*SOff)
             .addImm(HalfSize);
-    Hi = BuildMI(*MBB, MI, DL, get(HalfSGPROp))
+    Hi = BuildMI(*MBB, MI, DL, get(HalfSGPROp), RegHi)
                   .addReg(SBase->getReg(), getKillRegState(IsKill),
                           SBase->getSubReg())
                   .addReg(OffsetSGPR);