aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/LiveDebugVariables.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2011-01-13 23:35:53 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2011-01-13 23:35:53 +0000
commit088b30aa48aa8951ddfc04a23499671198b132f6 (patch)
tree09412b73a3af008bfe731f657f01d230fc3e1835 /llvm/lib/CodeGen/LiveDebugVariables.cpp
parent6cf14d828f9ec772dc9f8360571c560194b4670a (diff)
downloadllvm-088b30aa48aa8951ddfc04a23499671198b132f6.zip
llvm-088b30aa48aa8951ddfc04a23499671198b132f6.tar.gz
llvm-088b30aa48aa8951ddfc04a23499671198b132f6.tar.bz2
Better terminator avoidance.
This approach also works when the terminator doesn't have a slot index. (Which can happen??) llvm-svn: 123413
Diffstat (limited to 'llvm/lib/CodeGen/LiveDebugVariables.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveDebugVariables.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/LiveDebugVariables.cpp b/llvm/lib/CodeGen/LiveDebugVariables.cpp
index 5e8e309..38b270d 100644
--- a/llvm/lib/CodeGen/LiveDebugVariables.cpp
+++ b/llvm/lib/CodeGen/LiveDebugVariables.cpp
@@ -589,14 +589,6 @@ findInsertLocation(MachineBasicBlock *MBB, SlotIndex Idx, DebugLoc &DL,
SlotIndex Start = LIS.getMBBStartIdx(MBB);
Idx = Idx.getBaseIndex();
- // Don't insert anything after the first terminator.
- MachineBasicBlock::iterator Term = MBB->getFirstTerminator();
- if (Term != MBB->end() && !LIS.isNotInMIMap(Term) &&
- Idx >= LIS.getInstructionIndex(Term)) {
- DL = Term->getDebugLoc();
- return Term;
- }
-
// Try to find an insert location by going backwards from Idx.
MachineInstr *MI;
while (!(MI = LIS.getInstructionFromIndex(Idx))) {
@@ -611,7 +603,9 @@ findInsertLocation(MachineBasicBlock *MBB, SlotIndex Idx, DebugLoc &DL,
}
// We found an instruction. The insert point is after the instr.
DL = MI->getDebugLoc();
- return llvm::next(MachineBasicBlock::iterator(MI));
+ // Don't insert anything after the first terminator, though.
+ return MI->getDesc().isTerminator() ? MBB->getFirstTerminator() :
+ llvm::next(MachineBasicBlock::iterator(MI));
}
void UserValue::insertDebugValue(MachineBasicBlock *MBB, SlotIndex Idx,