diff options
author | Chris Lattner <sabre@nondot.org> | 2002-10-17 20:09:52 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-10-17 20:09:52 +0000 |
commit | b182216df843730cf5d9ff459b0174a8e4ed5bbb (patch) | |
tree | b093c2966bb8b102f58ea80c1b06a02232ff4148 /llvm/lib/Analysis/DataStructure/DataStructure.cpp | |
parent | 26783a5be58bfe4e0c6f7d6f1cc8ac69b420caea (diff) | |
download | bcm5719-llvm-b182216df843730cf5d9ff459b0174a8e4ed5bbb.tar.gz bcm5719-llvm-b182216df843730cf5d9ff459b0174a8e4ed5bbb.zip |
* Make the DSGraph cloner automatically merge global nodes
* BUClosure doesn't have to worry about global nodes
* TDClosure now works with global nodes
* Reenable DNE on TD pass, now that globals work right
llvm-svn: 4220
Diffstat (limited to 'llvm/lib/Analysis/DataStructure/DataStructure.cpp')
-rw-r--r-- | llvm/lib/Analysis/DataStructure/DataStructure.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/DataStructure/DataStructure.cpp b/llvm/lib/Analysis/DataStructure/DataStructure.cpp index 2418b0c6572..2313cd09e87 100644 --- a/llvm/lib/Analysis/DataStructure/DataStructure.cpp +++ b/llvm/lib/Analysis/DataStructure/DataStructure.cpp @@ -439,14 +439,25 @@ DSNodeHandle DSGraph::cloneInto(const DSGraph &G, for (unsigned i = FN, e = Nodes.size(); i != e; ++i) Nodes[i]->NodeType &= ~StripBits; - // Copy the value map... + // Copy the value map... and merge all of the global nodes... for (std::map<Value*, DSNodeHandle>::const_iterator I = G.ValueMap.begin(), - E = G.ValueMap.end(); I != E; ++I) - OldValMap[I->first] = DSNodeHandle(OldNodeMap[I->second.getNode()], - I->second.getOffset()); + E = G.ValueMap.end(); I != E; ++I) { + DSNodeHandle &H = OldValMap[I->first]; + H = DSNodeHandle(OldNodeMap[I->second.getNode()], I->second.getOffset()); + + if (isa<GlobalValue>(I->first)) { // Is this a global? + std::map<Value*, DSNodeHandle>::iterator GVI = ValueMap.find(I->first); + if (GVI != ValueMap.end()) { // Is the global value in this fun already? + GVI->second.mergeWith(H); + } else { + ValueMap[I->first] = H; // Add global pointer to this graph + } + } + } // Copy the function calls list... CopyFunctionCallsList(G.FunctionCalls, FunctionCalls, OldNodeMap); + // Return the returned node pointer... return DSNodeHandle(OldNodeMap[G.RetNode.getNode()], G.RetNode.getOffset()); } |