1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00

Fix an iterator invalidation problem. :(

llvm-svn: 11627
This commit is contained in:
Chris Lattner 2004-02-19 18:32:29 +00:00
parent 6c338f7627
commit 266206caed

View File

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