From 923fc05b3a95efad270b283f97b2670152a41efb Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 5 Feb 2003 21:59:58 +0000 Subject: Implement optimization for direct function call case. This dramatically reduces the number of function nodes created and speeds up analysis by about 10% overall. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5495 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/DataStructure/DataStructureStats.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'lib/Analysis/DataStructure/DataStructureStats.cpp') diff --git a/lib/Analysis/DataStructure/DataStructureStats.cpp b/lib/Analysis/DataStructure/DataStructureStats.cpp index 36d060edd5..c2ca7ea37c 100644 --- a/lib/Analysis/DataStructure/DataStructureStats.cpp +++ b/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& 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 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().getDSGraph(F); countCallees(F, tdGraph); return true; -- cgit v1.2.3