[llvm] r238701 - [PHITransAddr] Use std::find instead of std::count
David Majnemer
david.majnemer at gmail.com
Sun May 31 17:15:04 PDT 2015
Author: majnemer
Date: Sun May 31 19:15:04 2015
New Revision: 238701
URL: http://llvm.org/viewvc/llvm-project?rev=238701&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/Analysis/PHITransAddr.cpp
Modified: llvm/trunk/lib/Analysis/PHITransAddr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/PHITransAddr.cpp?rev=238701&r1=238700&r2=238701&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/PHITransAddr.cpp (original)
+++ llvm/trunk/lib/Analysis/PHITransAddr.cpp Sun May 31 19:15:04 2015
@@ -150,7 +150,8 @@ Value *PHITransAddr::PHITranslateSubExpr
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
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);
}
More information about the llvm-commits
mailing list