[llvm-commits] [llvm] r123277 - /llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Tue Jan 11 14:11:16 PST 2011


Author: stoklund
Date: Tue Jan 11 16:11:16 2011
New Revision: 123277

URL: http://llvm.org/viewvc/llvm-project?rev=123277&view=rev
Log:
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.

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=123277&r1=123276&r2=123277&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp Tue Jan 11 16:11:16 2011
@@ -587,6 +587,13 @@
   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))) {





More information about the llvm-commits mailing list