[llvm] r250320 - [IDFCalculator] Use DominatorTreeBase instead of DominatorTree

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 14 12:54:24 PDT 2015


Author: dannyb
Date: Wed Oct 14 14:54:24 2015
New Revision: 250320

URL: http://llvm.org/viewvc/llvm-project?rev=250320&view=rev
Log:
[IDFCalculator] Use DominatorTreeBase instead of DominatorTree

Summary:
IDFCalculator used a DominatorTree instance for its calculations. Since the PostDominatorTree struct is not a subclass of DominatorTree, it wasn't possible to use PDT in IDFCalculator to compute post-dominance frontiers.

This patch makes IDFCalculator work with a DominatorTreeBase<BasicBlock> instead, which enables PDTs to be utilized.

Patch by Victor Campos (vhscampos at gmail.com)

Reviewers: dberlin

Subscribers: dberlin, llvm-commits

Differential Revision: http://reviews.llvm.org/D13725

Modified:
    llvm/trunk/include/llvm/Analysis/IteratedDominanceFrontier.h

Modified: llvm/trunk/include/llvm/Analysis/IteratedDominanceFrontier.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/IteratedDominanceFrontier.h?rev=250320&r1=250319&r2=250320&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/IteratedDominanceFrontier.h (original)
+++ llvm/trunk/include/llvm/Analysis/IteratedDominanceFrontier.h Wed Oct 14 14:54:24 2015
@@ -34,7 +34,7 @@ namespace llvm {
 class BasicBlock;
 template <class T> class DomTreeNodeBase;
 typedef DomTreeNodeBase<BasicBlock> DomTreeNode;
-class DominatorTree;
+template <class T> class DominatorTreeBase;
 
 /// \brief Determine the iterated dominance frontier, given a set of defining
 /// blocks, and optionally, a set of live-in blocks.
@@ -47,7 +47,7 @@ class DominatorTree;
 class IDFCalculator {
 
 public:
-  IDFCalculator(DominatorTree &DT) : DT(DT), useLiveIn(false) {}
+  IDFCalculator(DominatorTreeBase<BasicBlock> &DT) : DT(DT), useLiveIn(false) {}
 
   /// \brief Give the IDF calculator the set of blocks in which the value is
   /// defined.  This is equivalent to the set of starting blocks it should be
@@ -85,7 +85,7 @@ public:
   void calculate(SmallVectorImpl<BasicBlock *> &IDFBlocks);
 
 private:
-  DominatorTree &DT;
+  DominatorTreeBase<BasicBlock> &DT;
   bool useLiveIn;
   DenseMap<DomTreeNode *, unsigned> DomLevels;
   const SmallPtrSetImpl<BasicBlock *> *LiveInBlocks;




More information about the llvm-commits mailing list