diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2013-02-16 17:06:38 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2013-02-16 17:06:38 +0000 |
commit | eb4774a972af4bdd36d8795625c8c5d96ca507d1 (patch) | |
tree | a843873e8a1a885e017d6c68f6aafb455d696975 | |
parent | 81474e98e10565e2ee0ad257ddc9469217520711 (diff) | |
download | external_llvm-eb4774a972af4bdd36d8795625c8c5d96ca507d1.zip external_llvm-eb4774a972af4bdd36d8795625c8c5d96ca507d1.tar.gz external_llvm-eb4774a972af4bdd36d8795625c8c5d96ca507d1.tar.bz2 |
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
-rw-r--r-- | lib/CodeGen/RegisterPressure.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/CodeGen/RegisterPressure.cpp b/lib/CodeGen/RegisterPressure.cpp index 62e95aa..97f22e1 100644 --- a/lib/CodeGen/RegisterPressure.cpp +++ b/lib/CodeGen/RegisterPressure.cpp @@ -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. |