[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp TopDownClosure.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sat Sep 20 18:59:01 PDT 2003
Changes in directory llvm/lib/Analysis/DataStructure:
BottomUpClosure.cpp updated: 1.65 -> 1.66
TopDownClosure.cpp updated: 1.55 -> 1.56
---
Log message:
Functions reachable from the arguments of unresolvable call nodes should
not have their arguments marked complete
---
Diffs of the changes:
Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp
diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.65 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.66
--- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.65 Sat Sep 20 18:27:05 2003
+++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Sat Sep 20 18:58:33 2003
@@ -51,7 +51,10 @@
// At the end of the bottom-up pass, the globals graph becomes complete.
// FIXME: This is not the right way to do this, but it is sorta better than
- // nothing!
+ // nothing! In particular, externally visible globals and unresolvable call
+ // nodes at the end of the BU phase should make things that they point to
+ // incomplete in the globals graph.
+ //
GlobalsGraph->maskIncompleteMarkers();
return false;
}
Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp
diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.55 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.56
--- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.55 Sat Sep 20 17:24:04 2003
+++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Sat Sep 20 18:58:33 2003
@@ -23,7 +23,7 @@
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 @@
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 @@
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!
More information about the llvm-commits
mailing list