[llvm-commits] CVS: llvm/lib/Transforms/IPO/DeadTypeElimination.cpp

Christopher Lattner lattner at cs.uiuc.edu
Sun Sep 8 16:48:01 PDT 2002


Changes in directory llvm/lib/Transforms/IPO:

DeadTypeElimination.cpp updated: 1.39 -> 1.40

---
Log message:

Factor silly code duplication out


---
Diffs of the changes:

Index: llvm/lib/Transforms/IPO/DeadTypeElimination.cpp
diff -u llvm/lib/Transforms/IPO/DeadTypeElimination.cpp:1.39 llvm/lib/Transforms/IPO/DeadTypeElimination.cpp:1.40
--- llvm/lib/Transforms/IPO/DeadTypeElimination.cpp:1.39	Thu Aug  8 14:01:21 2002
+++ llvm/lib/Transforms/IPO/DeadTypeElimination.cpp	Sun Sep  8 16:47:54 2002
@@ -74,21 +74,16 @@
       // Loop over all entries in the type plane...
       SymbolTable::VarMap &Plane = STI->second;
       for (SymbolTable::VarMap::iterator PI = Plane.begin(); PI != Plane.end();)
-        if (ShouldNukeSymtabEntry(*PI)) {    // Should we remove this entry?
+        // If this entry should be unconditionally removed, or if we detect that
+        // the type is not used, remove it.
+        //
+        if (ShouldNukeSymtabEntry(*PI) ||
+            !UsedTypes.count(cast<Type>(PI->second))) {
 #if MAP_IS_NOT_BRAINDEAD
           PI = Plane.erase(PI);     // STD C++ Map should support this!
 #else
           Plane.erase(PI);          // Alas, GCC 2.95.3 doesn't  *SIGH*
           PI = Plane.begin();
-#endif
-          ++NumKilled;
-          Changed = true;
-        } else if (!UsedTypes.count(cast<Type>(PI->second))) {
-#if MAP_IS_NOT_BRAINDEAD
-          PI = Plane.erase(PI);     // STD C++ Map should support this!
-#else
-          Plane.erase(PI);          // Alas, GCC 2.95.3 doesn't  *SIGH*
-          PI = Plane.begin();       // N^2 algorithms are fun.  :(
 #endif
           ++NumKilled;
           Changed = true;





More information about the llvm-commits mailing list