summaryrefslogtreecommitdiff
path: root/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
commit6212f9a304d7f8061c87920d39bddbc19afecb0c (patch)
tree4a95cd909db45df4fcea5840884438fdd5079688 /lib/CodeGen/LiveDebugVariables.cpp
parent5d754bfa320c558cbebded328454b75134f2cfee (diff)
downloadllvm-6212f9a304d7f8061c87920d39bddbc19afecb0c.tar.gz
llvm-6212f9a304d7f8061c87920d39bddbc19afecb0c.tar.bz2
llvm-6212f9a304d7f8061c87920d39bddbc19afecb0c.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131007 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveDebugVariables.cpp')
-rw-r--r--lib/CodeGen/LiveDebugVariables.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/CodeGen/LiveDebugVariables.cpp b/lib/CodeGen/LiveDebugVariables.cpp
index 41bf87fc5d..783a7e1ded 100644
--- a/lib/CodeGen/LiveDebugVariables.cpp
+++ b/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;