[llvm-branch-commits] [llvm] 728634d - [Support] Use llvm::is_contained (NFC)

Kazu Hirata via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Nov 25 23:58:02 PST 2020


Author: Kazu Hirata
Date: 2020-11-25T23:52:52-08:00
New Revision: 728634d0cfaacc9a5aff3e974066cd125a21a088

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

LOG: [Support] Use llvm::is_contained (NFC)

Added: 
    

Modified: 
    llvm/include/llvm/Support/GenericDomTreeConstruction.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/GenericDomTreeConstruction.h b/llvm/include/llvm/Support/GenericDomTreeConstruction.h
index 20e3cd7d2438..4b59ad1f017f 100644
--- a/llvm/include/llvm/Support/GenericDomTreeConstruction.h
+++ b/llvm/include/llvm/Support/GenericDomTreeConstruction.h
@@ -528,7 +528,7 @@ struct SemiNCAInfo {
         // If we wound another root in a (forward) DFS walk, remove the current
         // root from the set of roots, as it is reverse-reachable from the other
         // one.
-        if (llvm::find(Roots, N) != Roots.end()) {
+        if (llvm::is_contained(Roots, N)) {
           LLVM_DEBUG(dbgs() << "\tForward DFS walk found another root "
                             << BlockNamePrinter(N) << "\n\tRemoving root "
                             << BlockNamePrinter(Root) << "\n");
@@ -686,8 +686,7 @@ struct SemiNCAInfo {
     // root.
     if (!DT.isVirtualRoot(To->getIDom())) return false;
 
-    auto RIt = llvm::find(DT.Roots, To->getBlock());
-    if (RIt == DT.Roots.end())
+    if (!llvm::is_contained(DT.Roots, To->getBlock()))
       return false;  // To is not a root, nothing to update.
 
     LLVM_DEBUG(dbgs() << "\t\tAfter the insertion, " << BlockNamePrinter(To)
@@ -925,7 +924,7 @@ struct SemiNCAInfo {
     // The check is O(N), so run it only in debug configuration.
     auto IsSuccessor = [BUI](const NodePtr SuccCandidate, const NodePtr Of) {
       auto Successors = getChildren<IsPostDom>(Of, BUI);
-      return llvm::find(Successors, SuccCandidate) != Successors.end();
+      return llvm::is_contained(Successors, SuccCandidate);
     };
     (void)IsSuccessor;
     assert(!IsSuccessor(To, From) && "Deleted edge still exists in the CFG!");
@@ -1059,7 +1058,7 @@ struct SemiNCAInfo {
       const TreeNodePtr TN = DT.getNode(To);
       assert(TN);
       if (TN->getLevel() > Level) return true;
-      if (llvm::find(AffectedQueue, To) == AffectedQueue.end())
+      if (!llvm::is_contained(AffectedQueue, To))
         AffectedQueue.push_back(To);
 
       return false;


        


More information about the llvm-branch-commits mailing list