aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/DataStructure/TopDownClosure.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-11-07 06:31:54 +0000
committerChris Lattner <sabre@nondot.org>2002-11-07 06:31:54 +0000
commit076c1f923b515cbae6c4dfc25a84db4a0ce18272 (patch)
tree8e1aefdb5638c208eb1c453569ba13beb9f974c0 /lib/Analysis/DataStructure/TopDownClosure.cpp
parentcee3a4ef107f4c7d7ea0d8d44d02bd2d96eef7a7 (diff)
Implement a new mergeInGraph method, which basically factors code out of
the BU class. This will be used by the IPModRef class to do stuff, eventually perhaps the TD pass will use it also. Speaking of the TD pass, this also eliminates the self recursive case, which was broken, and couldn't occur anyway. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4599 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/TopDownClosure.cpp')
-rw-r--r--lib/Analysis/DataStructure/TopDownClosure.cpp60
1 files changed, 30 insertions, 30 deletions
diff --git a/lib/Analysis/DataStructure/TopDownClosure.cpp b/lib/Analysis/DataStructure/TopDownClosure.cpp
index 69422caa8f..817e734a9c 100644
--- a/lib/Analysis/DataStructure/TopDownClosure.cpp
+++ b/lib/Analysis/DataStructure/TopDownClosure.cpp
@@ -149,36 +149,36 @@ DSGraph &TDDataStructures::calculateGraph(Function &F) {
DEBUG(std::cerr << "\t [TD] Inlining caller #" << c << " '"
<< Caller.getName() << "' into callee: " << F.getName() << "\n");
- if (&Caller == &F) {
- // Self-recursive call: this can happen after a cycle of calls is inlined.
- ResolveCallSite(*Graph, CallSite);
- } else {
-
- // Recursively compute the graph for the Caller. It should be fully
- // resolved except if there is mutual recursion...
- //
- DSGraph &CG = calculateGraph(Caller); // Graph to inline
-
- DEBUG(std::cerr << "\t\t[TD] Got graph for " << Caller.getName()
- << " in: " << F.getName() << "\n");
-
- // These two maps keep track of where scalars in the old graph _used_
- // to point to, and of new nodes matching nodes of the old graph.
- std::map<Value*, DSNodeHandle> OldValMap;
- std::map<const DSNode*, DSNode*> OldNodeMap;
-
- // Translate call site from having links into the BU graph
- DSCallSite CallSiteInCG(CallSite, BUMaps[&Caller]);
-
- // Clone the Caller's graph into the current graph, keeping
- // track of where scalars in the old graph _used_ to point...
- // Do this here because it only needs to happens once for each Caller!
- // Strip scalars but not allocas since they are alive in callee.
- //
- DSNodeHandle RetVal = Graph->cloneInto(CG, OldValMap, OldNodeMap,
- /*StripAllocas*/ false);
- ResolveCallSite(*Graph, DSCallSite(CallSiteInCG, OldNodeMap));
- }
+ // Self recursion is not tracked in BU pass...
+ assert(&Caller != &F && "This cannot happen!\n");
+
+ // Recursively compute the graph for the Caller. It should be fully
+ // resolved except if there is mutual recursion...
+ //
+ DSGraph &CG = calculateGraph(Caller); // Graph to inline
+
+ DEBUG(std::cerr << "\t\t[TD] Got graph for " << Caller.getName()
+ << " in: " << F.getName() << "\n");
+
+ // Translate call site from having links into the BU graph
+ DSCallSite CallSiteInCG(CallSite, BUMaps[&Caller]);
+
+ // These two maps keep track of where scalars in the old graph _used_
+ // to point to, and of new nodes matching nodes of the old graph.
+ std::map<Value*, DSNodeHandle> OldValMap;
+ std::map<const DSNode*, DSNode*> OldNodeMap;
+
+ // FIXME: Eventually use DSGraph::mergeInGraph here...
+ // Graph->mergeInGraph(CallSiteInCG, CG, false);
+
+ // Clone the Caller's graph into the current graph, keeping
+ // track of where scalars in the old graph _used_ to point...
+ // Do this here because it only needs to happens once for each Caller!
+ // Strip scalars but not allocas since they are alive in callee.
+ //
+ DSNodeHandle RetVal = Graph->cloneInto(CG, OldValMap, OldNodeMap,
+ /*StripAllocas*/ false);
+ ResolveCallSite(*Graph, DSCallSite(CallSiteInCG, OldNodeMap));
}
// Recompute the Incomplete markers and eliminate unreachable nodes.