[llvm-commits] CVS: llvm/lib/Transforms/IPO/DeadTypeElimination.cpp
LLVM
llvm at cs.uiuc.edu
Tue May 25 07:22:07 PDT 2004
Changes in directory llvm/lib/Transforms/IPO:
DeadTypeElimination.cpp updated: 1.49 -> 1.50
---
Log message:
Convert to SymbolTable's new iteration interface.
---
Diffs of the changes: (+16 -17)
Index: llvm/lib/Transforms/IPO/DeadTypeElimination.cpp
diff -u llvm/lib/Transforms/IPO/DeadTypeElimination.cpp:1.49 llvm/lib/Transforms/IPO/DeadTypeElimination.cpp:1.50
--- llvm/lib/Transforms/IPO/DeadTypeElimination.cpp:1.49 Thu Feb 26 14:02:23 2004
+++ llvm/lib/Transforms/IPO/DeadTypeElimination.cpp Tue May 25 03:51:03 2004
@@ -74,25 +74,24 @@
// Check the symbol table for superfluous type entries...
//
// Grab the 'type' plane of the module symbol...
- SymbolTable::iterator STI = ST.find(Type::TypeTy);
- if (STI != ST.end()) {
- // Loop over all entries in the type plane...
- SymbolTable::VarMap &Plane = STI->second;
- for (SymbolTable::VarMap::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