summaryrefslogtreecommitdiff
path: root/lib/CodeGen/RegAllocFast.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2010-08-06 00:26:18 +0000
committerDevang Patel <dpatel@apple.com>2010-08-06 00:26:18 +0000
commit31defcf2349916ac759be33baaa4060703fd78df (patch)
treea0607eb43ffc3d7f221842871e47df0fc952b7c7 /lib/CodeGen/RegAllocFast.cpp
parent1f74590e9d1b9cf0f1f81a156efea73f76546e05 (diff)
downloadllvm-31defcf2349916ac759be33baaa4060703fd78df.tar.gz
llvm-31defcf2349916ac759be33baaa4060703fd78df.tar.bz2
llvm-31defcf2349916ac759be33baaa4060703fd78df.tar.xz
While emitting DBG_VALUE for registers spilled at the end of a block do not use location of MBB->end(). If a block does not have terminator then incoming iterator points to end().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110411 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegAllocFast.cpp')
-rw-r--r--lib/CodeGen/RegAllocFast.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/CodeGen/RegAllocFast.cpp b/lib/CodeGen/RegAllocFast.cpp
index 9567308aa7..9dff74b5dd 100644
--- a/lib/CodeGen/RegAllocFast.cpp
+++ b/lib/CodeGen/RegAllocFast.cpp
@@ -277,7 +277,14 @@ void RAFast::spillVirtReg(MachineBasicBlock::iterator MI,
int64_t Offset = 0;
if (DBG->getOperand(1).isImm())
Offset = DBG->getOperand(1).getImm();
- DebugLoc DL = MI->getDebugLoc();
+ DebugLoc DL;
+ if (MI == MBB->end()) {
+ // If MI is at basic block end then use last instruction's location.
+ MachineBasicBlock::iterator EI = MI;
+ DL = (--EI)->getDebugLoc();
+ }
+ else
+ DL = MI->getDebugLoc();
if (MachineInstr *NewDV =
TII->emitFrameIndexDebugValue(*MF, FI, Offset, MDPtr, DL)) {
MachineBasicBlock *MBB = DBG->getParent();