Fix a serious bug where we didn't insert globals into the globalset when
authorChris Lattner <sabre@nondot.org>
Tue, 22 Mar 2005 19:44:11 +0000 (19:44 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 22 Mar 2005 19:44:11 +0000 (19:44 +0000)
cloning a graph.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20770 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/DataStructure/DSGraph.h

index eeb261fae890ede5a4d0347973aabda1861c54d7..e8555c65326bf3f00da89d7f09b9963ea2c41d47 100644 (file)
@@ -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(); }