aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/CodeGen/LiveVariables.h
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-03-13 02:42:55 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-03-13 02:42:55 +0000
commitfe666a3592b2f59cf67a2f72a148f4db40f34b2f (patch)
tree43754aacb0c535e28b593dd8a0ed8be8c898ca53 /include/llvm/CodeGen/LiveVariables.h
parent6e7aeb16faddb3c5648d0f5b6aaff37f1dcfb5db (diff)
downloadexternal_llvm-fe666a3592b2f59cf67a2f72a148f4db40f34b2f.zip
external_llvm-fe666a3592b2f59cf67a2f72a148f4db40f34b2f.tar.gz
external_llvm-fe666a3592b2f59cf67a2f72a148f4db40f34b2f.tar.bz2
Improve VarInfo::removeKill() by using std::find instead of linear search.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48321 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/LiveVariables.h')
-rw-r--r--include/llvm/CodeGen/LiveVariables.h13
1 files changed, 6 insertions, 7 deletions
diff --git a/include/llvm/CodeGen/LiveVariables.h b/include/llvm/CodeGen/LiveVariables.h
index 859ec94..aa3b765 100644
--- a/include/llvm/CodeGen/LiveVariables.h
+++ b/include/llvm/CodeGen/LiveVariables.h
@@ -102,13 +102,12 @@ public:
/// machine instruction. Returns true if there was a kill
/// corresponding to this instruction, false otherwise.
bool removeKill(MachineInstr *MI) {
- for (std::vector<MachineInstr*>::iterator i = Kills.begin(),
- e = Kills.end(); i != e; ++i)
- if (*i == MI) {
- Kills.erase(i);
- return true;
- }
- return false;
+ std::vector<MachineInstr*>::iterator
+ I = std::find(Kills.begin(), Kills.end(), MI);
+ if (I == Kills.end())
+ return false;
+ Kills.erase(I);
+ return true;
}
void dump() const;