[PATCH] D19744: AMDGPU/SI: Set the kill flag on temp VGPRs used to restore SGPRs from scratch

Tom Stellard via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 29 14:04:03 PDT 2016


tstellarAMD created this revision.
tstellarAMD added a reviewer: arsenm.
tstellarAMD added a subscriber: llvm-commits.
Herald added a subscriber: arsenm.

When we restore an SGPR value from scratch, we first load it into a
temporary VGPR and then use v_readlane_b32 to copy the value from the
VGPR back into an SGPR.

We weren't setting the kill flag on the VGPR in the v_readlane_b32
instruction, so the register scavenger wasn't able to re-use this
temp value later.

I wasn't able to create a lit test for this.

http://reviews.llvm.org/D19744

Files:
  lib/Target/AMDGPU/SIRegisterInfo.cpp

Index: lib/Target/AMDGPU/SIRegisterInfo.cpp
===================================================================
--- lib/Target/AMDGPU/SIRegisterInfo.cpp
+++ lib/Target/AMDGPU/SIRegisterInfo.cpp
@@ -590,7 +590,7 @@
                   .addMemOperand(MMO);
           BuildMI(*MBB, MI, DL,
                   TII->getMCOpcodeFromPseudo(AMDGPU::V_READLANE_B32), SubReg)
-                  .addReg(TmpReg)
+                  .addReg(TmpReg, RegState::Kill)
                   .addImm(0)
                   .addReg(MI->getOperand(0).getReg(), RegState::ImplicitDefine);
         }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19744.55664.patch
Type: text/x-patch
Size: 575 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160429/608fbf5b/attachment.bin>


More information about the llvm-commits mailing list