Vincent says the element is at most once in the vector, so we don't need a full std::remove.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183541 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer 2013-06-07 18:18:12 +00:00
parent 149d1a1894
commit 2e0cebd881

View File

@ -198,9 +198,13 @@ MachineInstr *R600VectorRegMerger::RebuildVector(
.addReg(SubReg)
.addImm(Chan);
UpdatedRegToChan[SubReg] = Chan;
UpdatedUndef.erase(
std::remove(UpdatedUndef.begin(), UpdatedUndef.end(), Chan),
UpdatedUndef.end());
std::vector<unsigned>::iterator ChanPos =
std::find(UpdatedUndef.begin(), UpdatedUndef.end(), Chan);
if (ChanPos != UpdatedUndef.end())
UpdatedUndef.erase(ChanPos);
assert(std::find(UpdatedUndef.begin(), UpdatedUndef.end(), Chan) ==
UpdatedUndef.end() &&
"UpdatedUndef shouldn't contain Chan more than once!");
DEBUG(dbgs() << " ->"; Tmp->dump(););
(void)Tmp;
SrcVec = DstReg;