Replace erase loop with std::remove_if.

This avoids unnecessary copies. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175367 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer 2013-02-16 17:06:38 +00:00
parent 81474e98e1
commit eb4774a972

View File

@ -357,15 +357,14 @@ protected:
/// Collect physical and virtual register operands.
static void collectOperands(const MachineInstr *MI,
RegisterOperands &RegOpers) {
for(ConstMIBundleOperands OperI(MI); OperI.isValid(); ++OperI)
for (ConstMIBundleOperands OperI(MI); OperI.isValid(); ++OperI)
RegOpers.collect(*OperI);
// Remove redundant physreg dead defs.
for (unsigned i = RegOpers.DeadDefs.size(); i > 0; --i) {
unsigned Reg = RegOpers.DeadDefs[i-1];
if (containsReg(RegOpers.Defs, Reg))
RegOpers.DeadDefs.erase(&RegOpers.DeadDefs[i-1]);
}
SmallVectorImpl<unsigned>::iterator I =
std::remove_if(RegOpers.DeadDefs.begin(), RegOpers.DeadDefs.end(),
std::bind1st(std::ptr_fun(containsReg), RegOpers.Defs));
RegOpers.DeadDefs.erase(I, RegOpers.DeadDefs.end());
}
/// Force liveness of registers.