mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-29 14:40:25 +00: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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20740 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
73f1ac49f2
commit
eb144f5e73
@ -354,11 +354,11 @@ void BUDataStructures::calculateGraph(DSGraph &Graph) {
|
|||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
DSGraph *GI;
|
DSGraph *GI;
|
||||||
|
Instruction *TheCall = CS.getCallSite().getInstruction();
|
||||||
|
|
||||||
if (CalledFuncs.size() == 1) {
|
if (CalledFuncs.size() == 1) {
|
||||||
Function *Callee = CalledFuncs[0];
|
Function *Callee = CalledFuncs[0];
|
||||||
ActualCallees.insert(std::make_pair(CS.getCallSite().getInstruction(),
|
ActualCallees.insert(std::make_pair(TheCall, Callee));
|
||||||
Callee));
|
|
||||||
|
|
||||||
// Get the data structure graph for the called function.
|
// Get the data structure graph for the called function.
|
||||||
GI = &getDSGraph(*Callee); // Graph to inline
|
GI = &getDSGraph(*Callee); // Graph to inline
|
||||||
@ -378,12 +378,16 @@ void BUDataStructures::calculateGraph(DSGraph &Graph) {
|
|||||||
std::cerr << " calls " << CalledFuncs.size()
|
std::cerr << " calls " << CalledFuncs.size()
|
||||||
<< " fns from site: " << CS.getCallSite().getInstruction()
|
<< " fns from site: " << CS.getCallSite().getInstruction()
|
||||||
<< " " << *CS.getCallSite().getInstruction();
|
<< " " << *CS.getCallSite().getInstruction();
|
||||||
unsigned NumToPrint = CalledFuncs.size();
|
|
||||||
if (NumToPrint > 8) NumToPrint = 8;
|
|
||||||
std::cerr << " Fns =";
|
std::cerr << " Fns =";
|
||||||
|
unsigned NumPrinted = 0;
|
||||||
|
|
||||||
for (std::vector<Function*>::iterator I = CalledFuncs.begin(),
|
for (std::vector<Function*>::iterator I = CalledFuncs.begin(),
|
||||||
E = CalledFuncs.end(); I != E && NumToPrint; ++I, --NumToPrint)
|
E = CalledFuncs.end(); I != E; ++I) {
|
||||||
std::cerr << " " << (*I)->getName();
|
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";
|
std::cerr << "\n";
|
||||||
|
|
||||||
// See if we already computed a graph for this set of callees.
|
// See if we already computed a graph for this set of callees.
|
||||||
|
Loading…
Reference in New Issue
Block a user