[llvm-commits] [llvm] r123413 - /llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp
Jakob Stoklund Olesen
stoklund at 2pi.dk
Thu Jan 13 15:35:53 PST 2011
Author: stoklund
Date: Thu Jan 13 17:35:53 2011
New Revision: 123413
URL: http://llvm.org/viewvc/llvm-project?rev=123413&view=rev
Log:
Better terminator avoidance.
This approach also works when the terminator doesn't have a slot index. (Which
can happen??)
Modified:
llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp
Modified: llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp?rev=123413&r1=123412&r2=123413&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp Thu Jan 13 17:35:53 2011
@@ -589,14 +589,6 @@
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 @@
}
// 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,
More information about the llvm-commits
mailing list