summaryrefslogtreecommitdiff
path: root/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
commiteea666f216ad3a8f8cd88a969176f86add7228f3 (patch)
tree66ec73742c0f8bc1a6eae9d5d3e01119a644586f /lib/CodeGen/LiveDebugVariables.cpp
parent8fbbd1c03df9cb6844ce5ffaa24a0adf6e434a2c (diff)
downloadllvm-eea666f216ad3a8f8cd88a969176f86add7228f3.tar.gz
llvm-eea666f216ad3a8f8cd88a969176f86add7228f3.tar.bz2
llvm-eea666f216ad3a8f8cd88a969176f86add7228f3.tar.xz
Better terminator avoidance.
This approach also works when the terminator doesn't have a slot index. (Which can happen??) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123413 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveDebugVariables.cpp')
-rw-r--r--lib/CodeGen/LiveDebugVariables.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/CodeGen/LiveDebugVariables.cpp b/lib/CodeGen/LiveDebugVariables.cpp
index 5e8e30959c..38b270d5e1 100644
--- a/lib/CodeGen/LiveDebugVariables.cpp
+++ b/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,