forked from OSchip/llvm-project
R600: Fix a potential iterator invalidation issue.
As a bonus this reduces the loop from O(n^2) to O(n). llvm-svn: 183532
This commit is contained in:
parent
1edacecef4
commit
a857fe115b
|
@ -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