1
0
mirror of https://github.com/RPCS3/llvm.git synced 2025-01-10 22:46:25 +00:00

Fix an iterator invalidation problem. :(

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11627 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2004-02-19 18:32:29 +00:00
parent da8ab2ea45
commit a96478d7d6

@ -337,13 +337,22 @@ void LiveVariables::instructionChanged(MachineInstr *OldMI,
// Move the killed information over...
killed_iterator I, E;
tie(I, E) = killed_range(OldMI);
std::vector<unsigned> Regs;
for (killed_iterator A = I; A != E; ++A)
RegistersKilled.insert(std::make_pair(NewMI, A->second));
Regs.push_back(A->second);
RegistersKilled.erase(I, E);
for (unsigned i = 0, e = Regs.size(); i != e; ++i)
RegistersKilled.insert(std::make_pair(NewMI, Regs[i]));
Regs.clear();
// Move the dead information over...
tie(I, E) = dead_range(OldMI);
for (killed_iterator A = I; A != E; ++A)
RegistersDead.insert(std::make_pair(NewMI, A->second));
Regs.push_back(A->second);
RegistersDead.erase(I, E);
for (unsigned i = 0, e = Regs.size(); i != e; ++i)
RegistersDead.insert(std::make_pair(NewMI, Regs[i]));
}