[LCG] We don't actually need a set in each SCC to track the nodes. We
authorChandler Carruth <chandlerc@gmail.com>
Thu, 24 Apr 2014 08:55:36 +0000 (08:55 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Thu, 24 Apr 2014 08:55:36 +0000 (08:55 +0000)
can use the node -> SCC mapping in the top-level graph to test this on
the rare occasions we need it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207090 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/LazyCallGraph.h
lib/Analysis/LazyCallGraph.cpp

index 24607b293fbae66d2d7216d1a13baf1089a13dc7..ea65cbac1d30705cf3f1c7b282a16edc26ed3ca9 100644 (file)
@@ -217,7 +217,6 @@ public:
 
     SmallSetVector<SCC *, 1> ParentSCCs;
     SmallVector<Node *, 1> Nodes;
-    SmallPtrSet<Function *, 1> NodeSet;
 
     SCC() {}
 
index db6aed3b7a574ae7082b9b26a965eb8d70f1d810..832d2b9e7e636d616d12644239562a3ac0b3526a 100644 (file)
@@ -282,7 +282,6 @@ LazyCallGraph::SCC::removeInternalEdge(LazyCallGraph &G, Node &Caller,
   // Replace this SCC with the NewNodes we collected above.
   // FIXME: Simplify this when the SCC's datastructure is just a list.
   Nodes.clear();
-  NodeSet.clear();
 
   // Now we need to reconnect the current SCC to the graph.
   bool IsLeafSCC = true;
@@ -290,7 +289,6 @@ LazyCallGraph::SCC::removeInternalEdge(LazyCallGraph &G, Node &Caller,
     N->DFSNumber = -1;
     N->LowLink = -1;
     Nodes.push_back(N);
-    NodeSet.insert(&N->getFunction());
     for (Node &ChildN : *N) {
       if (NewNodes.count(&ChildN))
         continue;
@@ -393,10 +391,6 @@ LazyCallGraph::SCC *LazyCallGraph::formSCCFromDFSStack(
 
     SCCMap[SCCN] = NewSCC;
     NewSCC->Nodes.push_back(SCCN);
-    bool Inserted =
-        NewSCC->NodeSet.insert(&SCCN->getFunction());
-    (void)Inserted;
-    assert(Inserted && "Cannot have duplicates in the DFSStack!");
   }
   DFSStack.erase(SCCBegin, DFSStack.end());
 
@@ -406,7 +400,7 @@ LazyCallGraph::SCC *LazyCallGraph::formSCCFromDFSStack(
   bool IsLeafSCC = true;
   for (Node *SCCN : NewSCC->Nodes)
     for (Node &SCCChildN : *SCCN) {
-      if (NewSCC->NodeSet.count(&SCCChildN.getFunction()))
+      if (SCCMap.lookup(&SCCChildN) == NewSCC)
         continue;
       SCC &ChildSCC = *SCCMap.lookup(&SCCChildN);
       ChildSCC.ParentSCCs.insert(NewSCC);