[llvm] r207091 - [LCG] Switch the parent SCC tracking from a SmallSetVector to

Chandler Carruth chandlerc at gmail.com
Thu Apr 24 02:22:32 PDT 2014


Author: chandlerc
Date: Thu Apr 24 04:22:31 2014
New Revision: 207091

URL: http://llvm.org/viewvc/llvm-project?rev=207091&view=rev
Log:
[LCG] Switch the parent SCC tracking from a SmallSetVector to
a SmallPtrSet. Currently, there is no need for stable iteration in this
dimension, and I now thing there won't need to be going forward.

If this is ever re-introduced in any form, it needs to not be
a SetVector based solution because removal cannot be linear. There will
be many SCCs with large numbers of parents. When encountering these, the
incremental SCC update for intra-SCC edge removal was quadratic due to
linear removal (kind of).

I'm really hoping we can avoid having an ordering property here at all
though...

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=207091&r1=207090&r2=207091&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/LazyCallGraph.h (original)
+++ llvm/trunk/include/llvm/Analysis/LazyCallGraph.h Thu Apr 24 04:22:31 2014
@@ -215,7 +215,7 @@ public:
     friend class LazyCallGraph;
     friend class LazyCallGraph::Node;
 
-    SmallSetVector<SCC *, 1> ParentSCCs;
+    SmallPtrSet<SCC *, 1> ParentSCCs;
     SmallVector<Node *, 1> Nodes;
 
     SCC() {}
@@ -228,7 +228,7 @@ public:
 
   public:
     typedef SmallVectorImpl<Node *>::const_iterator iterator;
-    typedef pointee_iterator<SmallSetVector<SCC *, 1>::const_iterator> parent_iterator;
+    typedef pointee_iterator<SmallPtrSet<SCC *, 1>::const_iterator> parent_iterator;
 
     iterator begin() const { return Nodes.begin(); }
     iterator end() const { return Nodes.end(); }

Modified: llvm/trunk/lib/Analysis/LazyCallGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LazyCallGraph.cpp?rev=207091&r1=207090&r2=207091&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LazyCallGraph.cpp (original)
+++ llvm/trunk/lib/Analysis/LazyCallGraph.cpp Thu Apr 24 04:22:31 2014
@@ -157,7 +157,7 @@ void LazyCallGraph::SCC::removeEdge(Lazy
   // the caller no longer a parent of the callee. Walk the other call edges
   // in the caller to tell.
   if (!HasOtherCallToCalleeC) {
-    bool Removed = CalleeC.ParentSCCs.remove(this);
+    bool Removed = CalleeC.ParentSCCs.erase(this);
     (void)Removed;
     assert(Removed &&
            "Did not find the caller SCC in the callee SCC's parent list!");
@@ -239,7 +239,7 @@ LazyCallGraph::SCC::removeInternalEdge(L
         // However, we do need to remove this SCC from its SCC's parent set.
         SCC &ChildSCC = *G.SCCMap.lookup(&ChildN);
         if (&ChildSCC != this) {
-          ChildSCC.ParentSCCs.remove(this);
+          ChildSCC.ParentSCCs.erase(this);
           continue;
         }
 





More information about the llvm-commits mailing list