1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

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

llvm-svn: 20740
This commit is contained in:
Chris Lattner 2005-03-21 20:20:49 +00:00
parent 16724b79d7
commit 15ab6ab0c1

View File

@ -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.