diff options
author | Chris Lattner <sabre@nondot.org> | 2003-02-05 21:59:58 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-02-05 21:59:58 +0000 |
commit | 80614ee5ef9129cb3d6a7eefccad0ec31fd2e3a3 (patch) | |
tree | 3f673a8f067a74d590664cac2261c794015f6905 /llvm/lib/Analysis/DataStructure/DataStructureStats.cpp | |
parent | 5981c63e6e0a339c49441235a68426ed159b3cd6 (diff) | |
download | bcm5719-llvm-80614ee5ef9129cb3d6a7eefccad0ec31fd2e3a3.tar.gz bcm5719-llvm-80614ee5ef9129cb3d6a7eefccad0ec31fd2e3a3.zip |
Implement optimization for direct function call case. This dramatically
reduces the number of function nodes created and speeds up analysis by
about 10% overall.
llvm-svn: 5495
Diffstat (limited to 'llvm/lib/Analysis/DataStructure/DataStructureStats.cpp')
-rw-r--r-- | llvm/lib/Analysis/DataStructure/DataStructureStats.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/llvm/lib/Analysis/DataStructure/DataStructureStats.cpp b/llvm/lib/Analysis/DataStructure/DataStructureStats.cpp index 36d060edd56..c2ca7ea37c3 100644 --- a/llvm/lib/Analysis/DataStructure/DataStructureStats.cpp +++ b/llvm/lib/Analysis/DataStructure/DataStructureStats.cpp @@ -48,9 +48,7 @@ static bool isIndirectCallee(Value *V) { } -void DSGraphStats::countCallees(const Function& F, - const DSGraph& tdGraph) -{ +void DSGraphStats::countCallees(const Function& F, const DSGraph& tdGraph) { unsigned numIndirectCalls = 0, totalNumCallees = 0; const std::vector<DSCallSite>& callSites = tdGraph.getFunctionCalls(); @@ -58,12 +56,11 @@ void DSGraphStats::countCallees(const Function& F, if (isIndirectCallee(callSites[i].getCallInst().getCalledValue())) { // This is an indirect function call std::vector<GlobalValue*> Callees = - callSites[i].getCallee().getNode()->getGlobals(); - if (Callees.size() > 0) - { - totalNumCallees += Callees.size(); - ++numIndirectCalls; - } + callSites[i].getCalleeNode()->getGlobals(); + if (Callees.size() > 0) { + totalNumCallees += Callees.size(); + ++numIndirectCalls; + } #ifndef NDEBUG else std::cerr << "WARNING: No callee in Function " << F.getName() @@ -81,8 +78,7 @@ void DSGraphStats::countCallees(const Function& F, } -bool DSGraphStats::runOnFunction(Function& F) -{ +bool DSGraphStats::runOnFunction(Function& F) { const DSGraph& tdGraph = getAnalysis<TDDataStructures>().getDSGraph(F); countCallees(F, tdGraph); return true; |