aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/DataStructure/BottomUpClosure.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-02-01 21:49:43 +0000
committerChris Lattner <sabre@nondot.org>2005-02-01 21:49:43 +0000
commit20cd136c5df07517d96076313e77f093fa853ca6 (patch)
tree6525510003d8a9c20bcb20bbeae60b1dc7b4c834 /lib/Analysis/DataStructure/BottomUpClosure.cpp
parentaf8650e9c7a956bcd68314fd1ff1ed10bede2270 (diff)
Eliminate self-recursion as a special case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19979 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/BottomUpClosure.cpp')
-rw-r--r--lib/Analysis/DataStructure/BottomUpClosure.cpp97
1 files changed, 39 insertions, 58 deletions
diff --git a/lib/Analysis/DataStructure/BottomUpClosure.cpp b/lib/Analysis/DataStructure/BottomUpClosure.cpp
index aab47dba9d..07de2e473c 100644
--- a/lib/Analysis/DataStructure/BottomUpClosure.cpp
+++ b/lib/Analysis/DataStructure/BottomUpClosure.cpp
@@ -313,41 +313,31 @@ void BUDataStructures::calculateGraph(DSGraph &Graph) {
if (CalledFuncs.empty()) {
// Remember that we could not resolve this yet!
AuxCallsList.splice(AuxCallsList.end(), TempFCs, TempFCs.begin());
+ continue;
} else if (CalledFuncs.size() == 1) {
Function *Callee = *CalledFuncs.begin();
- if (ReturnNodes.count(Callee)) {
- // Self recursion... simply link up the formal arguments with the
- // actual arguments.
- DEBUG(std::cerr << " Self Inlining: " << Callee->getName() << "\n");
-
- // Handle self recursion by resolving the arguments and return value
- Graph.mergeInGraph(CS, *Callee, Graph, 0);
- } else {
- ActualCallees.insert(std::make_pair(CS.getCallSite().getInstruction(),
- Callee));
-
- // Get the data structure graph for the called function.
- //
- DSGraph &GI = getDSGraph(*Callee); // Graph to inline
-
- DEBUG(std::cerr << " Inlining graph for " << Callee->getName()
- << "[" << GI.getGraphSize() << "+"
- << GI.getAuxFunctionCalls().size() << "] into '"
- << Graph.getFunctionNames() << "' [" << Graph.getGraphSize() <<"+"
- << Graph.getAuxFunctionCalls().size() << "]\n");
- Graph.mergeInGraph(CS, *Callee, GI,
- DSGraph::KeepModRefBits |
- DSGraph::StripAllocaBit|DSGraph::DontCloneCallNodes);
- ++NumBUInlines;
-
+ ActualCallees.insert(std::make_pair(CS.getCallSite().getInstruction(),
+ Callee));
+
+ // Get the data structure graph for the called function.
+ //
+ DSGraph &GI = getDSGraph(*Callee); // Graph to inline
+
+ DEBUG(std::cerr << " Inlining graph for " << Callee->getName()
+ << "[" << GI.getGraphSize() << "+"
+ << GI.getAuxFunctionCalls().size() << "] into '"
+ << Graph.getFunctionNames() << "' [" << Graph.getGraphSize() <<"+"
+ << Graph.getAuxFunctionCalls().size() << "]\n");
+ Graph.mergeInGraph(CS, *Callee, GI,
+ DSGraph::KeepModRefBits |
+ DSGraph::StripAllocaBit|DSGraph::DontCloneCallNodes);
+ ++NumBUInlines;
+
#if 0
- Graph.writeGraphToFile(std::cerr, "bu_" + F.getName() + "_after_" +
- Callee->getName());
+ Graph.writeGraphToFile(std::cerr, "bu_" + F.getName() + "_after_" +
+ Callee->getName());
#endif
- }
-
- TempFCs.erase(TempFCs.begin());
} else {
if (!Printed)
std::cerr << "In Fns: " << Graph.getFunctionNames() << "\n";
@@ -366,39 +356,30 @@ void BUDataStructures::calculateGraph(DSGraph &Graph) {
for (std::set<Function*>::iterator I = CalledFuncs.begin(),
E = CalledFuncs.end(); I != E; ++I) {
Function *Callee = *I;
- if (ReturnNodes.count(Callee)) {
- // Self recursion... simply link up the formal arguments with the
- // actual arguments.
- DEBUG(std::cerr << " Self Inlining: " << Callee->getName() << "\n");
-
- // Handle self recursion by resolving the arguments and return value
- Graph.mergeInGraph(CS, *Callee, Graph, 0);
- } else {
- ActualCallees.insert(std::make_pair(CS.getCallSite().getInstruction(),
- Callee));
-
- // Get the data structure graph for the called function.
- //
- DSGraph &GI = getDSGraph(*Callee); // Graph to inline
-
- DEBUG(std::cerr << " Inlining graph for " << Callee->getName()
- << "[" << GI.getGraphSize() << "+"
- << GI.getAuxFunctionCalls().size() << "] into '"
- << Graph.getFunctionNames() << "' [" << Graph.getGraphSize() <<"+"
- << Graph.getAuxFunctionCalls().size() << "]\n");
- Graph.mergeInGraph(CS, *Callee, GI,
- DSGraph::KeepModRefBits |
- DSGraph::StripAllocaBit|DSGraph::DontCloneCallNodes);
- ++NumBUInlines;
+ ActualCallees.insert(std::make_pair(CS.getCallSite().getInstruction(),
+ Callee));
+ // Get the data structure graph for the called function.
+ //
+ DSGraph &GI = getDSGraph(*Callee); // Graph to inline
+
+ DEBUG(std::cerr << " Inlining graph for " << Callee->getName()
+ << "[" << GI.getGraphSize() << "+"
+ << GI.getAuxFunctionCalls().size() << "] into '"
+ << Graph.getFunctionNames() << "' [" << Graph.getGraphSize() <<"+"
+ << Graph.getAuxFunctionCalls().size() << "]\n");
+ Graph.mergeInGraph(CS, *Callee, GI,
+ DSGraph::KeepModRefBits |
+ DSGraph::StripAllocaBit|DSGraph::DontCloneCallNodes);
+ ++NumBUInlines;
+
#if 0
- Graph.writeGraphToFile(std::cerr, "bu_" + F.getName() + "_after_" +
- Callee->getName());
+ Graph.writeGraphToFile(std::cerr, "bu_" + F.getName() + "_after_" +
+ Callee->getName());
#endif
- }
}
- TempFCs.erase(TempFCs.begin());
}
+ TempFCs.erase(TempFCs.begin());
}
// Recompute the Incomplete markers