From: Evan Cheng Date: Thu, 13 Mar 2008 02:42:55 +0000 (+0000) Subject: Improve VarInfo::removeKill() by using std::find instead of linear search. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=fe666a3592b2f59cf67a2f72a148f4db40f34b2f;p=oota-llvm.git 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 --- diff --git a/include/llvm/CodeGen/LiveVariables.h b/include/llvm/CodeGen/LiveVariables.h index 859ec94e445..aa3b765a83f 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::iterator i = Kills.begin(), - e = Kills.end(); i != e; ++i) - if (*i == MI) { - Kills.erase(i); - return true; - } - return false; + std::vector::iterator + I = std::find(Kills.begin(), Kills.end(), MI); + if (I == Kills.end()) + return false; + Kills.erase(I); + return true; } void dump() const;