aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/LiveDebugVariables.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2011-01-11 22:11:16 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2011-01-11 22:11:16 +0000
commitb08773749a42a8c68afca96360b6e361147779b4 (patch)
tree81bffbd14905d9e8209655544fe8b47afa601761 /lib/CodeGen/LiveDebugVariables.cpp
parentb72d2a92b75daa9cbac7338aff0cd8ae04c2b4bd (diff)
Don't insert DBG_VALUE instructions after the first terminator.
For one, MachineBasicBlock::getFirstTerminator() doesn't understand what is happening, and it also makes sense to have all control flow run through the DBG_VALUE. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123277 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveDebugVariables.cpp')
-rw-r--r--lib/CodeGen/LiveDebugVariables.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/CodeGen/LiveDebugVariables.cpp b/lib/CodeGen/LiveDebugVariables.cpp
index da4b017cdc..9a67a630b5 100644
--- a/lib/CodeGen/LiveDebugVariables.cpp
+++ b/lib/CodeGen/LiveDebugVariables.cpp
@@ -587,6 +587,13 @@ 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() && 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))) {