remove dead method.
[oota-llvm.git] / include / llvm / ValueSymbolTable.h
index 53815ba7a4e6bda90f8edd4ae65604b8af069e55..7497dae3c469b49cfb3090f255929f21e2209ca3 100644 (file)
@@ -17,7 +17,6 @@
 #include "llvm/Value.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/System/DataTypes.h"
-#include "llvm/ADT/ilist_node.h"
 
 namespace llvm {
   template<typename ValueSubClass, typename ItemParentClass>
@@ -195,9 +194,15 @@ public:
 /// @name Mutators
 /// @{
 public:
-  /// insert - The method inserts a new entry into the stringmap.
+  /// insert - The method inserts a new entry into the stringmap. This will
+  /// replace existing entry, if any.
   void insert(StringRef Name,  NamedMDNode *Node) {
-    (void) mmap.GetOrCreateValue(Name, Node);
+    StringMapEntry<NamedMDNode *> &Entry = 
+      mmap.GetOrCreateValue(Name, Node);
+    if (Entry.getValue() != Node) {
+      mmap.remove(&Entry);
+      (void) mmap.GetOrCreateValue(Name, Node);
+    }
   }
   
   /// This method removes a NamedMDNode from the symbol table.