diff options
author | Chris Lattner <sabre@nondot.org> | 2004-02-17 19:06:47 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-02-17 19:06:47 +0000 |
commit | 2a6802ff4151122632215d45cbbaaa0d1eb3acf3 (patch) | |
tree | e97fa78140df663b2f83453cb8df7388d7558888 /llvm/lib | |
parent | 2b6d3c87a87292f83934991b01ea63d1110be0a5 (diff) | |
download | bcm5719-llvm-2a6802ff4151122632215d45cbbaaa0d1eb3acf3.tar.gz bcm5719-llvm-2a6802ff4151122632215d45cbbaaa0d1eb3acf3.zip |
When we complete the bottom-up pass, make sure to merge the globals in 'main' into
the globals graph.
llvm-svn: 11562
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp b/llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp index 5d71b19b574..ec8e2b6bef6 100644 --- a/llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp +++ b/llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp @@ -57,6 +57,23 @@ bool BUDataStructures::run(Module &M) { NumCallEdges += ActualCallees.size(); + + // At the end of the BU phase, clone the BU graph for main into the globals + // graph to make sure it has everything. + if (MainFunc) { + DSGraph &MainGraph = getOrCreateGraph(MainFunc); + DSScalarMap &MainSM = MainGraph.getScalarMap(); + ReachabilityCloner RC(*GlobalsGraph, MainGraph, DSGraph::StripAllocaBit); + + // Clone everything reachable from globals in the "main" graph into the + // globals graph. + for (DSScalarMap::global_iterator I = MainSM.global_begin(), + E = MainSM.global_end(); I != E; ++I) + RC.getClonedNH(MainSM[*I]); + + + } + // 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! In particular, externally visible globals and unresolvable call |