diff options
author | Chris Lattner <sabre@nondot.org> | 2005-03-21 20:20:49 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-03-21 20:20:49 +0000 |
commit | eb144f5e73d20f5bfb08bdc5a7163d8ba0fefcc4 (patch) | |
tree | 152c8b83aaa10592840a2be5b4843d49cba1e735 /lib/Analysis/DataStructure/BottomUpClosure.cpp | |
parent | 73f1ac49f23f1c90382e6e64bd2c08ceb27e2ab7 (diff) |
Fix a major problem where we didn't add call graph edges for call sites with
more than 1 callee. This fixes Analysis/DSGraph/FunctionPointerTable-const.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20740 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/BottomUpClosure.cpp')
-rw-r--r-- | lib/Analysis/DataStructure/BottomUpClosure.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/Analysis/DataStructure/BottomUpClosure.cpp b/lib/Analysis/DataStructure/BottomUpClosure.cpp index e7899c9e56..5549c8a672 100644 --- a/lib/Analysis/DataStructure/BottomUpClosure.cpp +++ b/lib/Analysis/DataStructure/BottomUpClosure.cpp @@ -354,11 +354,11 @@ void BUDataStructures::calculateGraph(DSGraph &Graph) { continue; } else { DSGraph *GI; + Instruction *TheCall = CS.getCallSite().getInstruction(); if (CalledFuncs.size() == 1) { Function *Callee = CalledFuncs[0]; - ActualCallees.insert(std::make_pair(CS.getCallSite().getInstruction(), - Callee)); + ActualCallees.insert(std::make_pair(TheCall, Callee)); // Get the data structure graph for the called function. GI = &getDSGraph(*Callee); // Graph to inline @@ -378,12 +378,16 @@ void BUDataStructures::calculateGraph(DSGraph &Graph) { std::cerr << " calls " << CalledFuncs.size() << " fns from site: " << CS.getCallSite().getInstruction() << " " << *CS.getCallSite().getInstruction(); - unsigned NumToPrint = CalledFuncs.size(); - if (NumToPrint > 8) NumToPrint = 8; std::cerr << " Fns ="; + unsigned NumPrinted = 0; + for (std::vector<Function*>::iterator I = CalledFuncs.begin(), - E = CalledFuncs.end(); I != E && NumToPrint; ++I, --NumToPrint) - std::cerr << " " << (*I)->getName(); + E = CalledFuncs.end(); I != E; ++I) { + if (NumPrinted++ < 8) std::cerr << " " << (*I)->getName(); + + // Add the call edges to the call graph. + ActualCallees.insert(std::make_pair(TheCall, *I)); + } std::cerr << "\n"; // See if we already computed a graph for this set of callees. |