[llvm] r207090 - [LCG] We don't actually need a set in each SCC to track the nodes. We

Chandler Carruth chandlerc at gmail.com
Thu Apr 24 01:55:36 PDT 2014


Author: chandlerc
Date: Thu Apr 24 03:55:36 2014
New Revision: 207090

URL: http://llvm.org/viewvc/llvm-project?rev=207090&view=rev
Log:
[LCG] We don't actually need a set in each SCC to track the nodes. We
can use the node -> SCC mapping in the top-level graph to test this on
the rare occasions we need it.

Modified:
    llvm/trunk/include/llvm/Analysis/LazyCallGraph.h
    llvm/trunk/lib/Analysis/LazyCallGraph.cpp

Modified: llvm/trunk/include/llvm/Analysis/LazyCallGraph.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LazyCallGraph.h?rev=207090&r1=207089&r2=207090&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/LazyCallGraph.h (original)
+++ llvm/trunk/include/llvm/Analysis/LazyCallGraph.h Thu Apr 24 03:55:36 2014
@@ -217,7 +217,6 @@ public:
 
     SmallSetVector<SCC *, 1> ParentSCCs;
     SmallVector<Node *, 1> Nodes;
-    SmallPtrSet<Function *, 1> NodeSet;
 
     SCC() {}
 

Modified: llvm/trunk/lib/Analysis/LazyCallGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LazyCallGraph.cpp?rev=207090&r1=207089&r2=207090&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LazyCallGraph.cpp (original)
+++ llvm/trunk/lib/Analysis/LazyCallGraph.cpp Thu Apr 24 03:55:36 2014
@@ -282,7 +282,6 @@ LazyCallGraph::SCC::removeInternalEdge(L
   // 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(L
     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::formS
 
     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::formS
   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);





More information about the llvm-commits mailing list