diff options
author | Chris Lattner <sabre@nondot.org> | 2004-02-27 20:05:15 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-02-27 20:05:15 +0000 |
commit | 0321b68f6b1ee13cc4dc96902e4c3fe7d6d18632 (patch) | |
tree | 6756bb4af4ad200e8876850477e57fbcc0b4e3f3 /lib/Analysis/DataStructure/DataStructure.cpp | |
parent | 6b586df3283b1e6b9e83e1a6cec5b63dacba33bd (diff) |
Only clone global nodes between graphs if both graphs have the global.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11928 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/DataStructure.cpp')
-rw-r--r-- | lib/Analysis/DataStructure/DataStructure.cpp | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/lib/Analysis/DataStructure/DataStructure.cpp b/lib/Analysis/DataStructure/DataStructure.cpp index fd252304b2..270a0bf9e0 100644 --- a/lib/Analysis/DataStructure/DataStructure.cpp +++ b/lib/Analysis/DataStructure/DataStructure.cpp @@ -33,10 +33,6 @@ namespace { Statistic<> NumDNE ("dsa", "Number of nodes removed by reachability"); Statistic<> NumTrivialDNE ("dsa", "Number of nodes trivially removed"); Statistic<> NumTrivialGlobalDNE("dsa", "Number of globals trivially removed"); - - cl::opt<bool> - EnableDSNodeGlobalRootsHack("enable-dsa-globalrootshack", cl::Hidden, - cl::desc("Make DSA less aggressive when cloning graphs")); }; #if 1 @@ -1239,15 +1235,12 @@ void DSGraph::mergeInGraph(const DSCallSite &CS, Function &F, AuxFunctionCalls.push_back(DSCallSite(Graph.AuxFunctionCalls[i], RC)); } - // If the user requested it, add the nodes that we need to clone to the - // RootNodes set. - if (!EnableDSNodeGlobalRootsHack) - // FIXME: Why is this not iterating over the globals in the graph?? - for (node_iterator NI = Graph.node_begin(), E = Graph.node_end(); - NI != E; ++NI) - if (!(*NI)->getGlobals().empty()) - RC.getClonedNH(*NI); - + // Clone over all globals that appear in the caller and callee graphs. + for (DSScalarMap::global_iterator GI = Graph.getScalarMap().global_begin(), + E = Graph.getScalarMap().global_end(); GI != E; ++GI) + if (GlobalVariable *GV = dyn_cast<GlobalVariable>(*GI)) + if (ScalarMap.count(GV)) + RC.merge(ScalarMap[GV], Graph.getNodeForValue(GV)); } else { DSNodeHandle RetVal = getReturnNodeFor(F); |