mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-01 15:33:33 +00:00
R600: Fix a potential iterator invalidation issue.
As a bonus this reduces the loop from O(n^2) to O(n). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183532 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
74f03455e5
commit
47b0c0a9a0
@ -198,11 +198,9 @@ MachineInstr *R600VectorRegMerger::RebuildVector(
|
||||
.addReg(SubReg)
|
||||
.addImm(Chan);
|
||||
UpdatedRegToChan[SubReg] = Chan;
|
||||
for (std::vector<unsigned>::iterator RemoveIt = UpdatedUndef.begin(),
|
||||
RemoveE = UpdatedUndef.end(); RemoveIt != RemoveE; ++ RemoveIt) {
|
||||
if (*RemoveIt == Chan)
|
||||
UpdatedUndef.erase(RemoveIt);
|
||||
}
|
||||
UpdatedUndef.erase(
|
||||
std::remove(UpdatedUndef.begin(), UpdatedUndef.end(), Chan),
|
||||
UpdatedUndef.end());
|
||||
DEBUG(dbgs() << " ->"; Tmp->dump(););
|
||||
(void)Tmp;
|
||||
SrcVec = DstReg;
|
||||
|
Loading…
Reference in New Issue
Block a user