[llvm-commits] CVS: llvm/include/llvm/Analysis/DataStructure/DSGraph.h

Chris Lattner lattner at cs.uiuc.edu
Tue Mar 22 11:44:28 PST 2005



Changes in directory llvm/include/llvm/Analysis/DataStructure:

DSGraph.h updated: 1.106 -> 1.107
---
Log message:

Fix a serious bug where we didn't insert globals into the globalset when
cloning a graph.


---
Diffs of the changes:  (+6 -1)

 DSGraph.h |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletion(-)


Index: llvm/include/llvm/Analysis/DataStructure/DSGraph.h
diff -u llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.106 llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.107
--- llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.106	Mon Mar 21 19:42:10 2005
+++ llvm/include/llvm/Analysis/DataStructure/DSGraph.h	Tue Mar 22 13:44:11 2005
@@ -94,7 +94,12 @@
   /// 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(); }






More information about the llvm-commits mailing list