From 5a130506287bd2e0ea8f8089a4091e60ea154729 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Mon, 1 Jun 2015 00:15:04 +0000 Subject: [PATCH] [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238701 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/PHITransAddr.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Analysis/PHITransAddr.cpp b/lib/Analysis/PHITransAddr.cpp index 177684fdc9a..71e2cdcbb42 100644 --- a/lib/Analysis/PHITransAddr.cpp +++ b/lib/Analysis/PHITransAddr.cpp @@ -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); }