[llvm] r183541 - Vincent says the element is at most once in the vector, so we don't need a full std::remove.
Benjamin Kramer
benny.kra at googlemail.com
Fri Jun 7 11:18:12 PDT 2013
Author: d0k
Date: Fri Jun 7 13:18:12 2013
New Revision: 183541
URL: http://llvm.org/viewvc/llvm-project?rev=183541&view=rev
Log:
Vincent says the element is at most once in the vector, so we don't need a full std::remove.
Modified:
llvm/trunk/lib/Target/R600/R600OptimizeVectorRegisters.cpp
Modified: llvm/trunk/lib/Target/R600/R600OptimizeVectorRegisters.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/R600OptimizeVectorRegisters.cpp?rev=183541&r1=183540&r2=183541&view=diff
==============================================================================
--- llvm/trunk/lib/Target/R600/R600OptimizeVectorRegisters.cpp (original)
+++ llvm/trunk/lib/Target/R600/R600OptimizeVectorRegisters.cpp Fri Jun 7 13:18:12 2013
@@ -198,9 +198,13 @@ MachineInstr *R600VectorRegMerger::Rebui
.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;
More information about the llvm-commits
mailing list