summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/LiveDebugVariables.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2011-05-06 19:31:19 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2011-05-06 19:31:19 +0000
commit57c8f58aeb31ab42d0163d756f5f7550f8f29c6d (patch)
tree89a5da73b1d385e1b1b678e4906cd77487466025 /llvm/lib/CodeGen/LiveDebugVariables.cpp
parent59ddb73d478c36efd0865f650433f84ce00e3ffe (diff)
downloadbcm5719-llvm-57c8f58aeb31ab42d0163d756f5f7550f8f29c6d.tar.gz
bcm5719-llvm-57c8f58aeb31ab42d0163d756f5f7550f8f29c6d.zip
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. llvm-svn: 131007
Diffstat (limited to 'llvm/lib/CodeGen/LiveDebugVariables.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveDebugVariables.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/LiveDebugVariables.cpp b/llvm/lib/CodeGen/LiveDebugVariables.cpp
index 41bf87fc5db..783a7e1ded0 100644
--- a/llvm/lib/CodeGen/LiveDebugVariables.cpp
+++ b/llvm/lib/CodeGen/LiveDebugVariables.cpp
@@ -795,7 +795,10 @@ UserValue::splitLocation(unsigned OldLocNo, ArrayRef<LiveInterval*> NewRegs) {
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;
OpenPOWER on IntegriCloud