summaryrefslogtreecommitdiff
path: root/lib/Transforms/IPO/DeadTypeElimination.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2004-05-25 08:53:40 +0000
committerReid Spencer <rspencer@reidspencer.com>2004-05-25 08:53:40 +0000
commit9231ac8b6f2c3f9877bdb7a223f7392061258ab6 (patch)
tree9f97206d6e486301c3bfb513b1872e5b1d4f5b20 /lib/Transforms/IPO/DeadTypeElimination.cpp
parentaf90b0d8b8071b4ddc9e5932abde7a1845defdba (diff)
downloadllvm-9231ac8b6f2c3f9877bdb7a223f7392061258ab6.tar.gz
llvm-9231ac8b6f2c3f9877bdb7a223f7392061258ab6.tar.bz2
llvm-9231ac8b6f2c3f9877bdb7a223f7392061258ab6.tar.xz
Convert to SymbolTable's new iteration interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13754 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO/DeadTypeElimination.cpp')
-rw-r--r--lib/Transforms/IPO/DeadTypeElimination.cpp33
1 files changed, 16 insertions, 17 deletions
diff --git a/lib/Transforms/IPO/DeadTypeElimination.cpp b/lib/Transforms/IPO/DeadTypeElimination.cpp
index c3a9f6edc5..28e5dca9f0 100644
--- a/lib/Transforms/IPO/DeadTypeElimination.cpp
+++ b/lib/Transforms/IPO/DeadTypeElimination.cpp
@@ -74,25 +74,24 @@ bool DTE::run(Module &M) {
// 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