[AMDGPU] Fixed asan error with agpr spilling
authorStanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com>
Thu, 11 Jul 2019 22:30:11 +0000 (22:30 +0000)
committerStanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com>
Thu, 11 Jul 2019 22:30:11 +0000 (22:30 +0000)
Instruction was used after it was erased.

llvm-svn: 365837

llvm/lib/Target/AMDGPU/SILowerSGPRSpills.cpp

index abfe894..9a93e84 100644 (file)
@@ -283,8 +283,11 @@ bool SILowerSGPRSpills::runOnMachineFunction(MachineFunction &MF) {
           int FI = MI.getOperand(FIOp).getIndex();
           unsigned VReg = TII->getNamedOperand(MI, AMDGPU::OpName::vdata)
             ->getReg();
-          if (FuncInfo->allocateVGPRSpillToAGPR(MF, FI, TRI->isAGPR(MRI, VReg)))
+          if (FuncInfo->allocateVGPRSpillToAGPR(MF, FI,
+                                                TRI->isAGPR(MRI, VReg))) {
             TRI->eliminateFrameIndex(MI, 0, FIOp, nullptr);
+            continue;
+          }
         }
 
         if (!TII->isSGPRSpill(MI))