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

Jakob Stoklund Olesen stoklund at 2pi.dk
Fri May 6 12:31:20 PDT 2011


Author: stoklund
Date: Fri May  6 14:31:19 2011
New Revision: 131007

URL: http://llvm.org/viewvc/llvm-project?rev=131007&view=rev
Log:
Iterate backwards over debug locations when splitting them so they can be safely erased.

This should unbreak dragonegg-i386-linux and build-self-4-mingw32.

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=131007&r1=131006&r2=131007&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp Fri May  6 14:31:19 2011
@@ -795,7 +795,10 @@
 bool
 UserValue::splitRegister(unsigned OldReg, ArrayRef<LiveInterval*> NewRegs) {
   bool DidChange = false;
-  for (unsigned LocNo = 0, E = locations.size(); LocNo != E; ++LocNo) {
+  // Split locations referring to OldReg. Iterate backwards so splitLocation can
+  // safely erase unuused locations.
+  for (unsigned i = locations.size(); i ; --i) {
+    unsigned LocNo = i-1;
     const MachineOperand *Loc = &locations[LocNo];
     if (!Loc->isReg() || Loc->getReg() != OldReg)
       continue;





More information about the llvm-commits mailing list