[PATCH] Add PostDominatorTree::getDescendants

Diego Novillo dnovillo at google.com
Tue Nov 26 10:12:47 PST 2013


Hi chandlerc,

    This patch adds the counter-part to DominatorTree::getDescendants.
    It also fixes a couple of comments I noticed out of date in the
    DominatorTree class.


http://llvm-reviews.chandlerc.com/D2273

Files:
  include/llvm/Analysis/Dominators.h
  include/llvm/Analysis/PostDominators.h

Index: include/llvm/Analysis/Dominators.h
===================================================================
--- include/llvm/Analysis/Dominators.h
+++ include/llvm/Analysis/Dominators.h
@@ -346,7 +346,7 @@
   DomTreeNodeBase<NodeT> *getRootNode() { return RootNode; }
   const DomTreeNodeBase<NodeT> *getRootNode() const { return RootNode; }
 
-  /// Get all nodes dominated by R, including R itself. Return true on success.
+  /// Get all nodes dominated by R, including R itself.
   void getDescendants(NodeT *R, SmallVectorImpl<NodeT *> &Result) const {
     const DomTreeNodeBase<NodeT> *RN = getNode(R);
     SmallVector<const DomTreeNodeBase<NodeT> *, 8> WL;
@@ -769,7 +769,7 @@
     return DT->getRootNode();
   }
 
-  /// Get all nodes dominated by R, including R itself. Return true on success.
+  /// Get all nodes dominated by R, including R itself.
   void getDescendants(BasicBlock *R,
                      SmallVectorImpl<BasicBlock *> &Result) const {
     DT->getDescendants(R, Result);
Index: include/llvm/Analysis/PostDominators.h
===================================================================
--- include/llvm/Analysis/PostDominators.h
+++ include/llvm/Analysis/PostDominators.h
@@ -79,6 +79,12 @@
     return DT->findNearestCommonDominator(A, B);
   }
 
+  /// Get all nodes post-dominated by R, including R itself.
+  void getDescendants(BasicBlock *R,
+                      SmallVectorImpl<BasicBlock *> &Result) const {
+    DT->getDescendants(R, Result);
+  }
+
   virtual void releaseMemory() {
     DT->releaseMemory();
   }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2273.1.patch
Type: text/x-patch
Size: 1560 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131126/11603e4d/attachment.bin>


More information about the llvm-commits mailing list