[llvm] r268265 - AMDGPU/SI: Fix bug in SIInstrInfo::insertWaitStates() uncovered by r268260

Tom Stellard via llvm-commits llvm-commits at lists.llvm.org
Mon May 2 11:02:24 PDT 2016


Author: tstellar
Date: Mon May  2 13:02:24 2016
New Revision: 268265

URL: http://llvm.org/viewvc/llvm-project?rev=268265&view=rev
Log:
AMDGPU/SI: Fix bug in SIInstrInfo::insertWaitStates() uncovered by r268260

We can't use MI->getDebugLoc() when MI is an iterator that could be
MBB.end().

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

Modified: llvm/trunk/lib/Target/AMDGPU/SIInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SIInstrInfo.cpp?rev=268265&r1=268264&r2=268265&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/SIInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/SIInstrInfo.cpp Mon May  2 13:02:24 2016
@@ -806,6 +806,7 @@ unsigned SIInstrInfo::calculateLDSSpillA
 void SIInstrInfo::insertWaitStates(MachineBasicBlock &MBB,
                                    MachineBasicBlock::iterator MI,
                                    int Count) const {
+  DebugLoc DL = MBB.findDebugLoc(MI);
   while (Count > 0) {
     int Arg;
     if (Count >= 8)
@@ -813,7 +814,7 @@ void SIInstrInfo::insertWaitStates(Machi
     else
       Arg = Count - 1;
     Count -= 8;
-    BuildMI(MBB, MI, MI->getDebugLoc(), get(AMDGPU::S_NOP))
+    BuildMI(MBB, MI, DL, get(AMDGPU::S_NOP))
             .addImm(Arg);
   }
 }




More information about the llvm-commits mailing list