[llvm-branch-commits] [llvm] ddc5a59 - [Analysis] Use llvm::erase_value (NFC)

Kazu Hirata via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Dec 14 22:44:29 PST 2020


Author: Kazu Hirata
Date: 2020-12-14T22:40:13-08:00
New Revision: ddc5a5920e5d00336ee12f9c4682969ac18bca7f

URL: https://github.com/llvm/llvm-project/commit/ddc5a5920e5d00336ee12f9c4682969ac18bca7f
DIFF: https://github.com/llvm/llvm-project/commit/ddc5a5920e5d00336ee12f9c4682969ac18bca7f.diff

LOG: [Analysis] Use llvm::erase_value (NFC)

Added: 
    

Modified: 
    llvm/include/llvm/Analysis/IntervalIterator.h
    llvm/lib/Analysis/AssumptionCache.cpp
    llvm/lib/Analysis/LoopPass.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Analysis/IntervalIterator.h b/llvm/include/llvm/Analysis/IntervalIterator.h
index efaaf9715b3d..38bb3bbb1719 100644
--- a/llvm/include/llvm/Analysis/IntervalIterator.h
+++ b/llvm/include/llvm/Analysis/IntervalIterator.h
@@ -227,9 +227,7 @@ class IntervalIterator {
 
       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/llvm/lib/Analysis/AssumptionCache.cpp b/llvm/lib/Analysis/AssumptionCache.cpp
index cb94f716bdb3..bb1ac616ee7f 100644
--- a/llvm/lib/Analysis/AssumptionCache.cpp
+++ b/llvm/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/llvm/lib/Analysis/LoopPass.cpp b/llvm/lib/Analysis/LoopPass.cpp
index 13e744f02665..9e470e998e67 100644
--- a/llvm/lib/Analysis/LoopPass.cpp
+++ b/llvm/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;


        


More information about the llvm-branch-commits mailing list