[llvm-commits] [poolalloc] r155782 - /poolalloc/trunk/lib/DSA/DataStructure.cpp

Will Dietz wdietz2 at illinois.edu
Sat Apr 28 20:21:54 PDT 2012


Author: wdietz2
Date: Sat Apr 28 22:21:53 2012
New Revision: 155782

URL: http://llvm.org/viewvc/llvm-project?rev=155782&view=rev
Log:
Remove duplicate unused implementation of HackedGraphSCCFinder.

Modified:
    poolalloc/trunk/lib/DSA/DataStructure.cpp

Modified: poolalloc/trunk/lib/DSA/DataStructure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DataStructure.cpp?rev=155782&r1=155781&r2=155782&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DataStructure.cpp (original)
+++ poolalloc/trunk/lib/DSA/DataStructure.cpp Sat Apr 28 22:21:53 2012
@@ -1104,115 +1104,6 @@
     }
 }
 
-namespace {
-  // HackedGraphSCCFinder - This is used to find nodes that have a path from the
-  // node to a node cloned by the ReachabilityCloner object contained.  To be
-  // extra obnoxious it ignores edges from nodes that are globals, and truncates
-  // search at RC marked nodes.  This is designed as an object so that
-  // intermediate results can be memoized across invocations of
-  // PathExistsToClonedNode.
-  struct HackedGraphSCCFinder {
-    ReachabilityCloner &RC;
-    unsigned CurNodeId;
-    std::vector<const DSNode*> SCCStack;
-    std::map<const DSNode*, std::pair<unsigned, bool> > NodeInfo;
-
-    HackedGraphSCCFinder(ReachabilityCloner &rc) : RC(rc), CurNodeId(1) {
-      // Remove null pointer as a special case.
-      NodeInfo[0] = std::make_pair(0, false);
-    }
-
-    std::pair<unsigned, bool> &VisitForSCCs(const DSNode *N);
-
-    bool PathExistsToClonedNode(const DSNode *N) {
-      return VisitForSCCs(N).second;
-    }
-
-    bool PathExistsToClonedNode(const DSCallSite &CS) {
-      if (PathExistsToClonedNode(CS.getRetVal().getNode()))
-        return true;
-      if (CS.isDirectCall() || PathExistsToClonedNode(CS.getCalleeNode()))
-        return true;
-      if (PathExistsToClonedNode(CS.getVAVal().getNode()))
-        return true;
-      for (unsigned i = 0, e = CS.getNumPtrArgs(); i != e; ++i)
-        if (PathExistsToClonedNode(CS.getPtrArg(i).getNode()))
-          return true;
-      return false;
-    }
-  };
-}
-
-std::pair<unsigned, bool> &HackedGraphSCCFinder::
-VisitForSCCs(const DSNode *N) {
-  std::map<const DSNode*, std::pair<unsigned, bool> >::iterator
-    NodeInfoIt = NodeInfo.lower_bound(N);
-  if (NodeInfoIt != NodeInfo.end() && NodeInfoIt->first == N)
-    return NodeInfoIt->second;
-
-  unsigned Min = CurNodeId++;
-  unsigned MyId = Min;
-  std::pair<unsigned, bool> &ThisNodeInfo =
-    NodeInfo.insert(NodeInfoIt,
-                    std::make_pair(N, std::make_pair(MyId, false)))->second;
-
-  // Base case: if we find a global, this doesn't reach the cloned graph
-  // portion.
-  if (N->isGlobalNode()) {
-    ThisNodeInfo.second = false;
-    return ThisNodeInfo;
-  }
-
-  // Base case: if this does reach the cloned graph portion... it does. :)
-  if (RC.hasClonedNode(N)) {
-    ThisNodeInfo.second = true;
-    return ThisNodeInfo;
-  }
-
-  SCCStack.push_back(N);
-
-  // Otherwise, check all successors.
-  bool AnyDirectSuccessorsReachClonedNodes = false;
-  for (DSNode::const_edge_iterator EI = N->edge_begin(), EE = N->edge_end();
-       EI != EE; ++EI)
-    if (DSNode * Succ = EI->second.getNode()) {
-      std::pair<unsigned, bool> &SuccInfo = VisitForSCCs(Succ);
-      if (SuccInfo.first < Min) Min = SuccInfo.first;
-      AnyDirectSuccessorsReachClonedNodes |= SuccInfo.second;
-    }
-
-  if (Min != MyId)
-    return ThisNodeInfo;  // Part of a large SCC.  Leave self on stack.
-
-  if (SCCStack.back() == N) {  // Special case single node SCC.
-    SCCStack.pop_back();
-    ThisNodeInfo.second = AnyDirectSuccessorsReachClonedNodes;
-    return ThisNodeInfo;
-  }
-
-  // Find out if any direct successors of any node reach cloned nodes.
-  if (!AnyDirectSuccessorsReachClonedNodes)
-    for (unsigned i = SCCStack.size() - 1; SCCStack[i] != N; --i)
-      for (DSNode::const_edge_iterator EI = N->edge_begin(), EE = N->edge_end();
-           EI != EE; ++EI)
-        if (DSNode * N = EI->second.getNode())
-          if (NodeInfo[N].second) {
-            AnyDirectSuccessorsReachClonedNodes = true;
-            goto OutOfLoop;
-          }
-OutOfLoop:
-  // If any successor reaches a cloned node, mark all nodes in this SCC as
-  // reaching the cloned node.
-  if (AnyDirectSuccessorsReachClonedNodes)
-    while (SCCStack.back() != N) {
-      NodeInfo[SCCStack.back()].second = true;
-      SCCStack.pop_back();
-    }
-  SCCStack.pop_back();
-  ThisNodeInfo.second = true;
-  return ThisNodeInfo;
-}
-
 /// markReachableNodes - This method recursively traverses the specified
 /// DSNodes, marking any nodes which are reachable.  All reachable nodes it adds
 /// to the set, which allows it to only traverse visited nodes once.





More information about the llvm-commits mailing list