[PHITransAddr] Use std::find instead of std::count

There is no need to visit all the elements if we are merely performing a
membership check.  NFCI.

llvm-svn: 238701
This commit is contained in:
David Majnemer 2015-06-01 00:15:04 +00:00
parent a4d22472f3
commit fc41f63d77
1 changed files with 4 additions and 2 deletions

View File

@ -150,7 +150,8 @@ Value *PHITransAddr::PHITranslateSubExpr(Value *V, BasicBlock *CurBB,
if (!Inst) return V;
// Determine whether 'Inst' is an input to our PHI translatable expression.
bool isInput = std::count(InstInputs.begin(), InstInputs.end(), Inst);
bool isInput =
std::find(InstInputs.begin(), InstInputs.end(), Inst) != InstInputs.end();
// Handle inputs instructions if needed.
if (isInput) {
@ -276,7 +277,8 @@ Value *PHITransAddr::PHITranslateSubExpr(Value *V, BasicBlock *CurBB,
isNSW = isNUW = false;
// If the old 'LHS' was an input, add the new 'LHS' as an input.
if (std::count(InstInputs.begin(), InstInputs.end(), BOp)) {
if (std::find(InstInputs.begin(), InstInputs.end(), BOp) !=
InstInputs.end()) {
RemoveInstInputs(BOp, InstInputs);
AddAsInput(LHS);
}