[llvm-commits] [llvm] r110411 - /llvm/trunk/lib/CodeGen/RegAllocFast.cpp
Devang Patel
dpatel at apple.com
Thu Aug 5 17:26:18 PDT 2010
Author: dpatel
Date: Thu Aug 5 19:26:18 2010
New Revision: 110411
URL: http://llvm.org/viewvc/llvm-project?rev=110411&view=rev
Log:
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().
Modified:
llvm/trunk/lib/CodeGen/RegAllocFast.cpp
Modified: llvm/trunk/lib/CodeGen/RegAllocFast.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocFast.cpp?rev=110411&r1=110410&r2=110411&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegAllocFast.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegAllocFast.cpp Thu Aug 5 19:26:18 2010
@@ -277,7 +277,14 @@
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();
More information about the llvm-commits
mailing list