[llvm] r283369 - AMDGPU: Do not re-use tmpreg in spill/restore lowering

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 5 13:02:52 PDT 2016


Author: matze
Date: Wed Oct  5 15:02:51 2016
New Revision: 283369

URL: http://llvm.org/viewvc/llvm-project?rev=283369&view=rev
Log:
AMDGPU: Do not re-use tmpreg in spill/restore lowering

The register scavenging code does not support multiple definitions of
the same vreg.

Differential Revision: https://reviews.llvm.org/D25220

Modified:
    llvm/trunk/lib/Target/AMDGPU/SIRegisterInfo.cpp

Modified: llvm/trunk/lib/Target/AMDGPU/SIRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SIRegisterInfo.cpp?rev=283369&r1=283368&r2=283369&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/SIRegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/SIRegisterInfo.cpp Wed Oct  5 15:02:51 2016
@@ -417,13 +417,13 @@ void SIRegisterInfo::spillSGPR(MachineBa
   const DebugLoc &DL = MI->getDebugLoc();
 
   unsigned NumSubRegs = getNumSubRegsForSpillOp(MI->getOpcode());
-  unsigned TmpReg = MRI.createVirtualRegister(&AMDGPU::VGPR_32RegClass);
   unsigned SuperReg = MI->getOperand(0).getReg();
   bool IsKill = MI->getOperand(0).isKill();
 
   // SubReg carries the "Kill" flag when SubReg == SuperReg.
   unsigned SubKillState = getKillRegState((NumSubRegs == 1) && IsKill);
   for (unsigned i = 0, e = NumSubRegs; i < e; ++i) {
+    unsigned TmpReg = MRI.createVirtualRegister(&AMDGPU::VGPR_32RegClass);
     unsigned SubReg = NumSubRegs == 1 ?
       SuperReg : getSubReg(SuperReg, getSubRegFromChannel(i));
 
@@ -503,7 +503,6 @@ void SIRegisterInfo::restoreSGPR(Machine
   const DebugLoc &DL = MI->getDebugLoc();
 
   unsigned NumSubRegs = getNumSubRegsForSpillOp(MI->getOpcode());
-  unsigned TmpReg = MRI.createVirtualRegister(&AMDGPU::VGPR_32RegClass);
   unsigned SuperReg = MI->getOperand(0).getReg();
 
   // m0 is not allowed as with readlane/writelane, so a temporary SGPR and
@@ -515,6 +514,7 @@ void SIRegisterInfo::restoreSGPR(Machine
   }
 
   for (unsigned i = 0, e = NumSubRegs; i < e; ++i) {
+    unsigned TmpReg = MRI.createVirtualRegister(&AMDGPU::VGPR_32RegClass);
     unsigned SubReg = NumSubRegs == 1 ?
       SuperReg : getSubReg(SuperReg, getSubRegFromChannel(i));
 




More information about the llvm-commits mailing list