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
diff --git a/llvm/lib/Analysis/DataStructure/Steensgaard.cpp b/llvm/lib/Analysis/DataStructure/Steensgaard.cpp
index b166ff1..d7a4948 100644
--- a/llvm/lib/Analysis/DataStructure/Steensgaard.cpp
+++ b/llvm/lib/Analysis/DataStructure/Steensgaard.cpp
@@ -163,8 +163,12 @@
DSCallSite &CurCall = Calls[i];
// Loop over the called functions, eliminating as many as possible...
- std::vector<GlobalValue*> CallTargets =
- CurCall.getCallee().getNode()->getGlobals();
+ std::vector<GlobalValue*> CallTargets;
+ if (CurCall.isDirectCall())
+ CallTargets.push_back(CurCall.getCalleeFunc());
+ else
+ CallTargets = CurCall.getCalleeNode()->getGlobals();
+
for (unsigned c = 0; c != CallTargets.size(); ) {
// If we can eliminate this function call, do so!
bool Eliminated = false;