From 0d955d0bf5cbbd50061309ad2c08c0dcf8f62039 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Thu, 11 Aug 2016 22:21:41 +0000 Subject: Use the range variant of find instead of unpacking begin/end If the result of the find is only used to compare against end(), just use is_contained instead. No functionality change is intended. llvm-svn: 278433 --- llvm/lib/Analysis/PHITransAddr.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'llvm/lib/Analysis/PHITransAddr.cpp') diff --git a/llvm/lib/Analysis/PHITransAddr.cpp b/llvm/lib/Analysis/PHITransAddr.cpp index b4aad74d50d..84ecd4ab980 100644 --- a/llvm/lib/Analysis/PHITransAddr.cpp +++ b/llvm/lib/Analysis/PHITransAddr.cpp @@ -62,8 +62,7 @@ static bool VerifySubExpr(Value *Expr, // If it's an instruction, it is either in Tmp or its operands recursively // are. - SmallVectorImpl::iterator Entry = - std::find(InstInputs.begin(), InstInputs.end(), I); + SmallVectorImpl::iterator Entry = find(InstInputs, I); if (Entry != InstInputs.end()) { InstInputs.erase(Entry); return true; @@ -126,8 +125,7 @@ static void RemoveInstInputs(Value *V, if (!I) return; // If the instruction is in the InstInputs list, remove it. - SmallVectorImpl::iterator Entry = - std::find(InstInputs.begin(), InstInputs.end(), I); + SmallVectorImpl::iterator Entry = find(InstInputs, I); if (Entry != InstInputs.end()) { InstInputs.erase(Entry); return; @@ -150,8 +148,7 @@ 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::find(InstInputs.begin(), InstInputs.end(), Inst) != InstInputs.end(); + bool isInput = is_contained(InstInputs, Inst); // Handle inputs instructions if needed. if (isInput) { @@ -165,7 +162,7 @@ Value *PHITransAddr::PHITranslateSubExpr(Value *V, BasicBlock *CurBB, // translated, we need to incorporate the value into the expression or fail. // In either case, the instruction itself isn't an input any longer. - InstInputs.erase(std::find(InstInputs.begin(), InstInputs.end(), Inst)); + InstInputs.erase(find(InstInputs, Inst)); // If this is a PHI, go ahead and translate it. if (PHINode *PN = dyn_cast(Inst)) @@ -272,8 +269,7 @@ 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::find(InstInputs.begin(), InstInputs.end(), BOp) != - InstInputs.end()) { + if (is_contained(InstInputs, BOp)) { RemoveInstInputs(BOp, InstInputs); AddAsInput(LHS); } -- cgit v1.2.3