[PATCH] D34703: [Dominators] Teach IDF to use level information

Jakub Kuderski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 30 14:52:24 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL306894: [Dominators] Teach IDF to use level information (authored by kuhar).

Changed prior to commit:
  https://reviews.llvm.org/D34703?vs=104230&id=104939#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D34703

Files:
  llvm/trunk/include/llvm/Analysis/IteratedDominanceFrontier.h
  llvm/trunk/lib/Analysis/IteratedDominanceFrontier.cpp


Index: llvm/trunk/lib/Analysis/IteratedDominanceFrontier.cpp
===================================================================
--- llvm/trunk/lib/Analysis/IteratedDominanceFrontier.cpp
+++ llvm/trunk/lib/Analysis/IteratedDominanceFrontier.cpp
@@ -20,14 +20,6 @@
 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 @@
 
   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 @@
         if (SuccNode->getIDom() == Node)
           continue;
 
-        unsigned SuccLevel = DomLevels.lookup(SuccNode);
+        const unsigned SuccLevel = SuccNode->getLevel();
         if (SuccLevel > RootLevel)
           continue;
 
Index: llvm/trunk/include/llvm/Analysis/IteratedDominanceFrontier.h
===================================================================
--- llvm/trunk/include/llvm/Analysis/IteratedDominanceFrontier.h
+++ llvm/trunk/include/llvm/Analysis/IteratedDominanceFrontier.h
@@ -86,7 +86,6 @@
 private:
   DominatorTreeBase<BasicBlock> &DT;
   bool useLiveIn;
-  DenseMap<DomTreeNode *, unsigned> DomLevels;
   const SmallPtrSetImpl<BasicBlock *> *LiveInBlocks;
   const SmallPtrSetImpl<BasicBlock *> *DefBlocks;
 };


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34703.104939.patch
Type: text/x-patch
Size: 1878 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170630/f6c579f2/attachment.bin>


More information about the llvm-commits mailing list