diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2014-04-23 23:12:06 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2014-04-23 23:12:06 +0000 |
commit | a10e240377c770b1b511182d321b0de5c731d89d (patch) | |
tree | caddbd8028f0f6a49a7893cfbde1d30cf16eb5be /llvm/lib/Analysis/LazyCallGraph.cpp | |
parent | 2c0f4ef2418a9b0f0d50e540bbb64539bcca19b0 (diff) | |
download | llvm-a10e240377c770b1b511182d321b0de5c731d89d.zip llvm-a10e240377c770b1b511182d321b0de5c731d89d.tar.gz llvm-a10e240377c770b1b511182d321b0de5c731d89d.tar.bz2 |
[LCG] Switch the SCC lookup to be in terms of call graph nodes rather
than functions. So far, this access pattern is *much* more common. It
seems likely that any user of this interface is going to have nodes at
the point that they are querying the SCCs.
No functionality changed.
llvm-svn: 207045
Diffstat (limited to 'llvm/lib/Analysis/LazyCallGraph.cpp')
-rw-r--r-- | llvm/lib/Analysis/LazyCallGraph.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/llvm/lib/Analysis/LazyCallGraph.cpp b/llvm/lib/Analysis/LazyCallGraph.cpp index 4ad6375..d317938 100644 --- a/llvm/lib/Analysis/LazyCallGraph.cpp +++ b/llvm/lib/Analysis/LazyCallGraph.cpp @@ -141,7 +141,7 @@ void LazyCallGraph::SCC::removeEdge(LazyCallGraph &G, Function &Caller, bool HasOtherCallOutsideSCC = false; for (Node *N : *this) { for (Node *Callee : *N) { - SCC *OtherCalleeC = G.SCCMap.lookup(&Callee->F); + SCC *OtherCalleeC = G.SCCMap.lookup(Callee); if (OtherCalleeC == &CalleeC) { HasOtherCallToCalleeC = true; break; @@ -237,7 +237,7 @@ LazyCallGraph::SCC::removeInternalEdge(LazyCallGraph &G, Node &Caller, Node *ChildN = *I; // If this child isn't currently in this SCC, no need to process it. // However, we do need to remove this SCC from its SCC's parent set. - SCC *ChildSCC = G.SCCMap.lookup(&ChildN->F); + SCC *ChildSCC = G.SCCMap.lookup(ChildN); assert(ChildSCC && "Everything reachable must already be in *some* SCC"); if (ChildSCC != this) { @@ -296,7 +296,7 @@ LazyCallGraph::SCC::removeInternalEdge(LazyCallGraph &G, Node &Caller, for (Node *ChildN : *N) { if (NewNodes.count(ChildN)) continue; - SCC *ChildSCC = G.SCCMap.lookup(&ChildN->getFunction()); + SCC *ChildSCC = G.SCCMap.lookup(ChildN); assert(ChildSCC && "Must have all child SCCs processed when building a new SCC!"); ChildSCC->ParentSCCs.insert(this); @@ -331,7 +331,7 @@ void LazyCallGraph::removeEdge(Node &CallerN, Function &Callee) { CallerN.Callees.erase(CallerN.Callees.begin() + IndexMapI->second); CallerN.CalleeIndexMap.erase(IndexMapI); - SCC *CallerC = SCCMap.lookup(&CallerN.F); + SCC *CallerC = SCCMap.lookup(&CallerN); if (!CallerC) { // We can only remove edges when the edge isn't actively participating in // a DFS walk. Either it must have been popped into an SCC, or it must not @@ -347,7 +347,7 @@ void LazyCallGraph::removeEdge(Node &CallerN, Function &Callee) { assert(CalleeN && "If the caller is in an SCC, we have to have explored all " "its transitively called functions."); - SCC *CalleeC = SCCMap.lookup(&Callee); + SCC *CalleeC = SCCMap.lookup(CalleeN); assert(CalleeC && "The caller has an SCC, and thus by necessity so does the callee."); @@ -395,7 +395,7 @@ LazyCallGraph::SCC *LazyCallGraph::formSCCFromDFSStack( "We cannot have a low link in an SCC lower than its root on the " "stack!"); - SCCMap[&SCCN->getFunction()] = NewSCC; + SCCMap[SCCN] = NewSCC; NewSCC->Nodes.push_back(SCCN); bool Inserted = NewSCC->NodeSet.insert(&SCCN->getFunction()); @@ -412,7 +412,7 @@ LazyCallGraph::SCC *LazyCallGraph::formSCCFromDFSStack( for (Node *SCCChildN : *SCCN) { if (NewSCC->NodeSet.count(&SCCChildN->getFunction())) continue; - SCC *ChildSCC = SCCMap.lookup(&SCCChildN->getFunction()); + SCC *ChildSCC = SCCMap.lookup(SCCChildN); assert(ChildSCC && "Must have all child SCCs processed when building a new SCC!"); ChildSCC->ParentSCCs.insert(NewSCC); @@ -443,7 +443,7 @@ LazyCallGraph::SCC *LazyCallGraph::getNextSCCInPostOrder() { if (SI->first->DFSNumber == 0) { // This node hasn't been visited before, assign it a DFS number and remove // it from the entry set. - assert(!SCCMap.count(&SI->first->getFunction()) && + assert(!SCCMap.count(SI->first) && "Found a node with 0 DFS number but already in an SCC!"); SI->first->LowLink = SI->first->DFSNumber = NextDFSNumber++; SCCEntryNodes.remove(&SI->first->getFunction()); |