aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/DataStructure/TopDownClosure.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Analysis/DataStructure/TopDownClosure.cpp')
-rw-r--r--lib/Analysis/DataStructure/TopDownClosure.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/lib/Analysis/DataStructure/TopDownClosure.cpp b/lib/Analysis/DataStructure/TopDownClosure.cpp
index 460088f6d2..8df60ba2fa 100644
--- a/lib/Analysis/DataStructure/TopDownClosure.cpp
+++ b/lib/Analysis/DataStructure/TopDownClosure.cpp
@@ -116,17 +116,22 @@ void TDDataStructures::calculateGraph(Function &F) {
std::multimap<Function*, const DSCallSite*> CalleeSites;
for (unsigned i = 0, e = CallSites.size(); i != e; ++i) {
const DSCallSite &CS = CallSites[i];
- const std::vector<GlobalValue*> Callees =
- CS.getCallee().getNode()->getGlobals();
-
- // Loop over all of the functions that this call may invoke...
- for (unsigned c = 0, e = Callees.size(); c != e; ++c)
- if (Function *F = dyn_cast<Function>(Callees[c])) // If this is a fn...
- if (!F->isExternal()) // If it's not external
- CalleeSites.insert(std::make_pair(F, &CS)); // Keep track of it!
+ if (CS.isDirectCall()) {
+ if (!CS.getCalleeFunc()->isExternal()) // If it's not external
+ CalleeSites.insert(std::make_pair(CS.getCalleeFunc(), &CS)); // Keep it
+ } else {
+ const std::vector<GlobalValue*> &Callees =
+ CS.getCalleeNode()->getGlobals();
+
+ // Loop over all of the functions that this call may invoke...
+ for (unsigned c = 0, e = Callees.size(); c != e; ++c)
+ if (Function *F = dyn_cast<Function>(Callees[c])) // If this is a fn...
+ if (!F->isExternal()) // If it's not extern
+ CalleeSites.insert(std::make_pair(F, &CS)); // Keep track of it!
+ }
}
- // Now that we have information about all of the callees, propogate the
+ // Now that we have information about all of the callees, propagate the
// current graph into the callees.
//
DEBUG(std::cerr << " [TD] Inlining '" << F.getName() << "' into "