mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 19:12:56 +02:00
[Dominators] Teach IDF to use level information
Summary: This patch teaches IteratedDominanceFrontier to use the level information stored in DomTreeNodes instead of calculating it manually. Reviewers: dberlin, sanjoy, davide Reviewed By: davide Subscribers: davide, llvm-commits Differential Revision: https://reviews.llvm.org/D34703 llvm-svn: 306894
This commit is contained in:
parent
4dcd08b921
commit
84d62a0102
@ -86,7 +86,6 @@ public:
|
||||
private:
|
||||
DominatorTreeBase<BasicBlock> &DT;
|
||||
bool useLiveIn;
|
||||
DenseMap<DomTreeNode *, unsigned> DomLevels;
|
||||
const SmallPtrSetImpl<BasicBlock *> *LiveInBlocks;
|
||||
const SmallPtrSetImpl<BasicBlock *> *DefBlocks;
|
||||
};
|
||||
|
@ -20,14 +20,6 @@ namespace llvm {
|
||||
template <class NodeTy>
|
||||
void IDFCalculator<NodeTy>::calculate(
|
||||
SmallVectorImpl<BasicBlock *> &PHIBlocks) {
|
||||
// If we haven't computed dominator tree levels, do so now.
|
||||
if (DomLevels.empty()) {
|
||||
for (auto DFI = df_begin(DT.getRootNode()), DFE = df_end(DT.getRootNode());
|
||||
DFI != DFE; ++DFI) {
|
||||
DomLevels[*DFI] = DFI.getPathLength() - 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Use a priority queue keyed on dominator tree level so that inserted nodes
|
||||
// are handled from the bottom of the dominator tree upwards.
|
||||
typedef std::pair<DomTreeNode *, unsigned> DomTreeNodePair;
|
||||
@ -37,7 +29,7 @@ void IDFCalculator<NodeTy>::calculate(
|
||||
|
||||
for (BasicBlock *BB : *DefBlocks) {
|
||||
if (DomTreeNode *Node = DT.getNode(BB))
|
||||
PQ.push(std::make_pair(Node, DomLevels.lookup(Node)));
|
||||
PQ.push({Node, Node->getLevel()});
|
||||
}
|
||||
|
||||
SmallVector<DomTreeNode *, 32> Worklist;
|
||||
@ -72,7 +64,7 @@ void IDFCalculator<NodeTy>::calculate(
|
||||
if (SuccNode->getIDom() == Node)
|
||||
continue;
|
||||
|
||||
unsigned SuccLevel = DomLevels.lookup(SuccNode);
|
||||
const unsigned SuccLevel = SuccNode->getLevel();
|
||||
if (SuccLevel > RootLevel)
|
||||
continue;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user