[llvm-commits] [bug_122] CVS: llvm/lib/Transforms/IPO/DeadTypeElimination.cpp
LLVM
llvm at cs.uiuc.edu
Sun May 16 21:38:09 PDT 2004
Changes in directory llvm/lib/Transforms/IPO:
DeadTypeElimination.cpp updated: 1.49.4.1 -> 1.49.4.2
---
Log message:
Changes necessary resulting from the new SymbolTable interface for
distinctly handling Types and Values.
---
Diffs of the changes: (+16 -17)
Index: llvm/lib/Transforms/IPO/DeadTypeElimination.cpp
diff -u llvm/lib/Transforms/IPO/DeadTypeElimination.cpp:1.49.4.1 llvm/lib/Transforms/IPO/DeadTypeElimination.cpp:1.49.4.2
--- llvm/lib/Transforms/IPO/DeadTypeElimination.cpp:1.49.4.1 Wed May 12 11:33:43 2004
+++ llvm/lib/Transforms/IPO/DeadTypeElimination.cpp Sun May 16 21:38:42 2004
@@ -74,25 +74,24 @@
// Check the symbol table for superfluous type entries...
//
// Grab the 'type' plane of the module symbol...
- SymbolTable::type_iterator STI = ST.find(Type::TypeTy);
- if (STI != ST.end()) {
- // Loop over all entries in the type plane...
- SymbolTable::ValueMap &Plane = STI->second;
- for (SymbolTable::value_iterator PI = Plane.begin(); PI != Plane.end();) {
- // If this entry should be unconditionally removed, or if we detect that
- // the type is not used, remove it.
- const Type *RHS = cast<Type>(PI->second);
- if (ShouldNukeSymtabEntry(RHS) || !UsedTypes.count(RHS)) {
- Plane.erase(PI++);
- ++NumKilled;
- Changed = true;
- } else {
- ++PI;
- // We only need to leave one name for each type.
- UsedTypes.erase(RHS);
- }
+ SymbolTable::type_iterator TI = ST.type_begin();
+ while ( TI != ST.type_end() ) {
+ // If this entry should be unconditionally removed, or if we detect that
+ // the type is not used, remove it.
+ const Type *RHS = TI->second;
+ if (ShouldNukeSymtabEntry(RHS) || !UsedTypes.count(RHS)) {
+ SymbolTable::type_iterator ToRemove = TI++;
+ ST.remove(TI->second);
+ ++NumKilled;
+ Changed = true;
+ } else {
+ ++TI;
+ // We only need to leave one name for each type.
+ UsedTypes.erase(RHS);
}
}
return Changed;
}
+
+// vim: sw=2
More information about the llvm-commits
mailing list