[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@gmail.com)

Reviewers: dberlin

Subscribers: dberlin, llvm-commits

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

llvm-svn: 250320
This commit is contained in:
Daniel Berlin 2015-10-14 19:54:24 +00:00
parent 8241405ad4
commit 92b9ec3c84
1 changed files with 3 additions and 3 deletions

View File

@ -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;