From c82f0756af17564278b843637f85a7cfb5838f0e Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Mon, 14 Dec 2020 22:40:13 -0800 Subject: [PATCH] [Analysis] Use llvm::erase_value (NFC) --- include/llvm/Analysis/IntervalIterator.h | 4 +--- lib/Analysis/AssumptionCache.cpp | 4 +--- lib/Analysis/LoopPass.cpp | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/include/llvm/Analysis/IntervalIterator.h b/include/llvm/Analysis/IntervalIterator.h index efaaf9715b3..38bb3bbb171 100644 --- a/include/llvm/Analysis/IntervalIterator.h +++ b/include/llvm/Analysis/IntervalIterator.h @@ -227,9 +227,7 @@ private: if (Int->isSuccessor(NodeHeader)) { // If we were in the successor list from before... remove from succ list - Int->Successors.erase(std::remove(Int->Successors.begin(), - Int->Successors.end(), NodeHeader), - Int->Successors.end()); + llvm::erase_value(Int->Successors, NodeHeader); } // Now that we have discovered that Node is in the interval, perhaps some diff --git a/lib/Analysis/AssumptionCache.cpp b/lib/Analysis/AssumptionCache.cpp index cb94f716bdb..bb1ac616ee7 100644 --- a/lib/Analysis/AssumptionCache.cpp +++ b/lib/Analysis/AssumptionCache.cpp @@ -163,9 +163,7 @@ void AssumptionCache::unregisterAssumption(CallInst *CI) { AffectedValues.erase(AVI); } - AssumeHandles.erase( - remove_if(AssumeHandles, [CI](ResultElem &RE) { return CI == RE; }), - AssumeHandles.end()); + erase_value(AssumeHandles, CI); } void AssumptionCache::AffectedValueCallbackVH::deleted() { diff --git a/lib/Analysis/LoopPass.cpp b/lib/Analysis/LoopPass.cpp index 13e744f0266..9e470e998e6 100644 --- a/lib/Analysis/LoopPass.cpp +++ b/lib/Analysis/LoopPass.cpp @@ -117,7 +117,7 @@ void LPPassManager::markLoopAsDeleted(Loop &L) { // there. However, we have to be careful to not remove the back of the queue // as that is assumed to match the current loop. assert(LQ.back() == CurrentLoop && "Loop queue back isn't the current loop!"); - LQ.erase(std::remove(LQ.begin(), LQ.end(), &L), LQ.end()); + llvm::erase_value(LQ, &L); if (&L == CurrentLoop) { CurrentLoopDeleted = true;