[llvm] 11b3b10 - [Support] Use llvm::children and llvm::inverse_children (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 20 14:30:49 PST 2024


Author: Kazu Hirata
Date: 2024-01-20T14:30:37-08:00
New Revision: 11b3b1085645f0819552eb8a17e1928f60570fce

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

LOG: [Support] Use llvm::children and llvm::inverse_children (NFC)

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/GenericDomTree.h b/llvm/include/llvm/Support/GenericDomTree.h
index 62186a368e964d..4fce9d8bfb2b68 100644
--- a/llvm/include/llvm/Support/GenericDomTree.h
+++ b/llvm/include/llvm/Support/GenericDomTree.h
@@ -850,17 +850,16 @@ class DominatorTreeBase {
   void Split(typename GraphTraits<N>::NodeRef NewBB) {
     using GraphT = GraphTraits<N>;
     using NodeRef = typename GraphT::NodeRef;
-    assert(std::distance(GraphT::child_begin(NewBB),
-                         GraphT::child_end(NewBB)) == 1 &&
+    assert(llvm::hasSingleElement(children<N>(NewBB)) &&
            "NewBB should have a single successor!");
     NodeRef NewBBSucc = *GraphT::child_begin(NewBB);
 
-    SmallVector<NodeRef, 4> PredBlocks(children<Inverse<N>>(NewBB));
+    SmallVector<NodeRef, 4> PredBlocks(inverse_children<N>(NewBB));
 
     assert(!PredBlocks.empty() && "No predblocks?");
 
     bool NewBBDominatesNewBBSucc = true;
-    for (auto *Pred : children<Inverse<N>>(NewBBSucc)) {
+    for (auto *Pred : inverse_children<N>(NewBBSucc)) {
       if (Pred != NewBB && !dominates(NewBBSucc, Pred) &&
           isReachableFromEntry(Pred)) {
         NewBBDominatesNewBBSucc = false;


        


More information about the llvm-commits mailing list