diff options
author | Chris Lattner <sabre@nondot.org> | 2003-09-20 23:58:33 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-09-20 23:58:33 +0000 |
commit | 11fc9301fbe7597aa5be1940b014fbbd85732a56 (patch) | |
tree | 787d2bbcc231684ab761d8d9d350397a9d04a35e /lib/Analysis/DataStructure/TopDownClosure.cpp | |
parent | ec157b7cde458d99440a1b07e5ac904a503da7b6 (diff) |
Functions reachable from the arguments of unresolvable call nodes should
not have their arguments marked complete
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8639 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/TopDownClosure.cpp')
-rw-r--r-- | lib/Analysis/DataStructure/TopDownClosure.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/Analysis/DataStructure/TopDownClosure.cpp b/lib/Analysis/DataStructure/TopDownClosure.cpp index 1266e5ee09..7da1746125 100644 --- a/lib/Analysis/DataStructure/TopDownClosure.cpp +++ b/lib/Analysis/DataStructure/TopDownClosure.cpp @@ -23,7 +23,7 @@ namespace { void TDDataStructures::markReachableFunctionsExternallyAccessible(DSNode *N, hash_set<DSNode*> &Visited) { - if (Visited.count(N)) return; + if (!N || Visited.count(N)) return; Visited.insert(N); for (unsigned i = 0, e = N->getNumLinks(); i != e; ++i) { @@ -46,6 +46,7 @@ void TDDataStructures::markReachableFunctionsExternallyAccessible(DSNode *N, bool TDDataStructures::run(Module &M) { BUDataStructures &BU = getAnalysis<BUDataStructures>(); GlobalsGraph = new DSGraph(BU.getGlobalsGraph()); + GlobalsGraph->setPrintAuxCalls(); // Figure out which functions must not mark their arguments complete because // they are accessible outside this compilation unit. Currently, these @@ -57,6 +58,17 @@ bool TDDataStructures::run(Module &M) { I != E; ++I) if (isa<GlobalValue>(I->first)) markReachableFunctionsExternallyAccessible(I->second.getNode(), Visited); + + // Loop over unresolved call nodes. Any functions passed into (but not + // returned!?) from unresolvable call nodes may be invoked outside of the + // current module. + const std::vector<DSCallSite> &Calls = GlobalsGraph->getAuxFunctionCalls(); + for (unsigned i = 0, e = Calls.size(); i != e; ++i) { + const DSCallSite &CS = Calls[i]; + for (unsigned arg = 0, e = CS.getNumPtrArgs(); arg != e; ++arg) + markReachableFunctionsExternallyAccessible(CS.getPtrArg(arg).getNode(), + Visited); + } Visited.clear(); // Functions without internal linkage also have unknown incoming arguments! |