summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-03-22 19:44:11 +0000
committerChris Lattner <sabre@nondot.org>2005-03-22 19:44:11 +0000
commitee76095307116248736ea87af929c81ee537d894 (patch)
tree7c574514547c7ca495e2868711321eceb4695337 /include
parentf29dc07aaed9eff098f4bf2134b45f53104a4502 (diff)
downloadllvm-ee76095307116248736ea87af929c81ee537d894.tar.gz
llvm-ee76095307116248736ea87af929c81ee537d894.tar.bz2
llvm-ee76095307116248736ea87af929c81ee537d894.tar.xz
Fix a serious bug where we didn't insert globals into the globalset when
cloning a graph. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20770 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Analysis/DataStructure/DSGraph.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/llvm/Analysis/DataStructure/DSGraph.h b/include/llvm/Analysis/DataStructure/DSGraph.h
index eeb261fae8..e8555c6532 100644
--- a/include/llvm/Analysis/DataStructure/DSGraph.h
+++ b/include/llvm/Analysis/DataStructure/DSGraph.h
@@ -94,7 +94,12 @@ public:
/// getRawEntryRef - This method can be used by clients that are aware of the
/// global value equivalence class in effect.
DSNodeHandle &getRawEntryRef(Value *V) {
- return ValueMap[V];
+ std::pair<iterator,bool> IP =
+ ValueMap.insert(std::make_pair(V, DSNodeHandle()));
+ if (IP.second) // Inserted the new entry into the map.
+ if (GlobalValue *GV = dyn_cast<GlobalValue>(V))
+ GlobalSet.insert(GV);
+ return IP.first->second;
}
unsigned count(Value *V) const { return ValueMap.find(V) != ValueMap.end(); }