[PATCH] D13725: [IDFCalculator] Use DominatorTreeBase instead of DominatorTree

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 14 07:37:36 PDT 2015


LGTM.
Do you need me to commit this for you?


On Wed, Oct 14, 2015 at 7:00 AM, Victor Campos <vhscampos at gmail.com> wrote:
> vhscampos created this revision.
> vhscampos added a reviewer: dberlin.
> vhscampos added a subscriber: llvm-commits.
>
> 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.
>
> http://reviews.llvm.org/D13725
>
> Files:
>   include/llvm/Analysis/IteratedDominanceFrontier.h
>
> Index: include/llvm/Analysis/IteratedDominanceFrontier.h
> ===================================================================
> --- include/llvm/Analysis/IteratedDominanceFrontier.h
> +++ include/llvm/Analysis/IteratedDominanceFrontier.h
> @@ -34,7 +34,7 @@
>  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 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 @@
>    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