aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/DataStructure/BottomUpClosure.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-02-17 19:06:47 +0000
committerChris Lattner <sabre@nondot.org>2004-02-17 19:06:47 +0000
commit28a631d37e073befd1099cd713d47a31a4b40879 (patch)
tree3d808bdd88d1b33bb9114bd4051acd826e3b9569 /lib/Analysis/DataStructure/BottomUpClosure.cpp
parent3c5df2612cbe7cca40a16d8ac411a94cc409a2da (diff)
When we complete the bottom-up pass, make sure to merge the globals in 'main' into
the globals graph. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11562 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/BottomUpClosure.cpp')
-rw-r--r--lib/Analysis/DataStructure/BottomUpClosure.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/Analysis/DataStructure/BottomUpClosure.cpp b/lib/Analysis/DataStructure/BottomUpClosure.cpp
index 5d71b19b57..ec8e2b6bef 100644
--- a/lib/Analysis/DataStructure/BottomUpClosure.cpp
+++ b/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