[llvm-commits] CVS: llvm/lib/VMCore/SymbolTable.cpp

Chris Lattner lattner at cs.uiuc.edu
Sat Mar 5 21:21:57 PST 2005



Changes in directory llvm/lib/VMCore:

SymbolTable.cpp updated: 1.54 -> 1.55
---
Log message:

Remove some really gross and hard to understand code now that 
InternallyInconsistent is always false.


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

 SymbolTable.cpp |   33 ++++++---------------------------
 1 files changed, 6 insertions(+), 27 deletions(-)


Index: llvm/lib/VMCore/SymbolTable.cpp
diff -u llvm/lib/VMCore/SymbolTable.cpp:1.54 llvm/lib/VMCore/SymbolTable.cpp:1.55
--- llvm/lib/VMCore/SymbolTable.cpp:1.54	Sat Mar  5 23:13:42 2005
+++ llvm/lib/VMCore/SymbolTable.cpp	Sat Mar  5 23:21:40 2005
@@ -94,7 +94,6 @@
 // Remove a value
 void SymbolTable::remove(Value *N) {
   assert(N->hasName() && "Value doesn't have name!");
-  if (InternallyInconsistent) return;
 
   plane_iterator PI = pmap.find(N->getType());
   assert(PI != pmap.end() &&
@@ -115,15 +114,11 @@
   assert(PI != pmap.end() && "Value doesn't have an entry in this table?");
   ValueMap &VM = PI->second;
 
-  value_iterator VI;
+  value_iterator VI = VM.find(V->getName());
+  assert(VI != VM.end() && "Value does have an entry in this table?");
 
-  if (!InternallyInconsistent) {
-    VI = VM.find(V->getName());
-    assert(VI != VM.end() && "Value does have an entry in this table?");
-
-    // Remove the old entry.
-    VM.erase(VI);
-  }
+  // Remove the old entry.
+  VM.erase(VI);
 
   // See if we can insert the new name.
   VI = VM.lower_bound(name);
@@ -141,7 +136,6 @@
 
 // removeEntry - Remove a value from the symbol table...
 Value *SymbolTable::removeEntry(plane_iterator Plane, value_iterator Entry) {
-  if (InternallyInconsistent) return 0;
   assert(Plane != pmap.end() &&
          Entry != Plane->second.end() && "Invalid entry to remove!");
 
@@ -189,7 +183,6 @@
 
 // removeEntry - Remove a type from the symbol table...
 Type* SymbolTable::removeEntry(type_iterator Entry) {
-  if (InternallyInconsistent) return 0;
   assert( Entry != tmap.end() && "Invalid entry to remove!");
 
   const Type* Result = Entry->second;
@@ -249,11 +242,8 @@
     VM = &PI->second;
     VI = VM->lower_bound(Name);
     if (VI != VM->end() && VI->first == Name) {
-      std::string UniqueName = getUniqueName(VTy, Name);
-      assert(InternallyInconsistent == false &&
-             "Infinite loop inserting value!");
-      V->Name = UniqueName;
-      VM->insert(VI, make_pair(UniqueName, V));
+      V->Name = getUniqueName(VTy, Name);
+      VM->insert(make_pair(V->Name, V));
       return;
     }
   }
@@ -371,17 +361,6 @@
           // one use the old one...
           NewGV->uncheckedReplaceAllUsesWith(ExistGV);
           
-          // Now we just convert it to an unnamed method... which won't get
-          // added to our symbol table.  The problem is that if we call
-          // setName on the method that it will try to remove itself from
-          // the symbol table and die... because it's not in the symtab
-          // right now.  To fix this, we have an internally consistent flag
-          // that turns remove into a noop.  Thus the name will get null'd
-          // out, but the symbol table won't get upset.
-          //
-          assert(InternallyInconsistent == false &&
-                 "Symbol table already inconsistent!");
-
           // Update NewGV's name, we're about the remove it from the symbol
           // table.
           NewGV->Name = "";






More information about the llvm-commits mailing list