R600/SI: Add kill flag when copying scratch offset to a register
authorTom Stellard <thomas.stellard@amd.com>
Tue, 20 Jan 2015 17:49:45 +0000 (17:49 +0000)
committerTom Stellard <thomas.stellard@amd.com>
Tue, 20 Jan 2015 17:49:45 +0000 (17:49 +0000)
This allows us to re-use the same register for the scratch offset
when accessing large private arrays.

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

lib/Target/R600/SIRegisterInfo.cpp
test/CodeGen/R600/scratch-buffer.ll

index f9feea470f15ea94f7e1eb75f6d355bf5665c3ee..59ff8a27d0574f17caa56f42083035a116c3f1d5 100644 (file)
@@ -289,7 +289,7 @@ void SIRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator MI,
         BuildMI(*MBB, MI, MI->getDebugLoc(),
                 TII->get(AMDGPU::V_MOV_B32_e32), TmpReg)
                 .addImm(Offset);
-        FIOp.ChangeToRegister(TmpReg, false);
+        FIOp.ChangeToRegister(TmpReg, false, false, true);
       }
     }
   }
index cc2a522c9a8c0f2e311c0d8d62c31a1008788e49..740328a495da7718b37a8c200b4da7d00082d5bb 100644 (file)
@@ -3,9 +3,14 @@
 ; When a frame index offset is more than 12-bits, make sure we don't store
 ; it in mubuf's offset field.
 
+; Also, make sure we use the same register for storing the scratch buffer addresss
+; for both stores. This register is allocated by the register scavenger, so we
+; should be able to reuse the same regiser for each scratch buffer access.
+
 ; CHECK-LABEL: {{^}}legal_offset_fi:
-; CHECK: buffer_store_dword v{{[0-9]+}}, v{{[0-9]+}}, s[{{[0-9]+}}:{{[0-9]+}}], s{{[0-9]+}} offen
-; CHECK: v_mov_b32_e32 [[OFFSET:v[0-9]+]], 0x8000
+; CHECK: v_mov_b32_e32 [[OFFSET:v[0-9]+]], 0{{$}}
+; CHECK: buffer_store_dword v{{[0-9]+}}, [[OFFSET]], s[{{[0-9]+}}:{{[0-9]+}}], s{{[0-9]+}} offen
+; CHECK: v_mov_b32_e32 [[OFFSET]], 0x8000
 ; CHECK: buffer_store_dword v{{[0-9]+}}, [[OFFSET]], s[{{[0-9]+}}:{{[0-9]+}}], s{{[0-9]+}} offen{{$}}
 
 define void @legal_offset_fi(i32 addrspace(1)* %out, i32 %cond, i32 %if_offset, i32 %else_offset) {