[Analysis] Use llvm::erase_value (NFC)
authorKazu Hirata <kazu@google.com>
Tue, 15 Dec 2020 06:40:13 +0000 (22:40 -0800)
committerKazu Hirata <kazu@google.com>
Tue, 15 Dec 2020 06:40:13 +0000 (22:40 -0800)
llvm/include/llvm/Analysis/IntervalIterator.h
llvm/lib/Analysis/AssumptionCache.cpp
llvm/lib/Analysis/LoopPass.cpp

index efaaf97..38bb3bb 100644 (file)
@@ -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
index cb94f71..bb1ac61 100644 (file)
@@ -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() {
index 13e744f..9e470e9 100644 (file)
@@ -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;