summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-09-08 21:47:54 +0000
committerChris Lattner <sabre@nondot.org>2002-09-08 21:47:54 +0000
commit5f00d66cc3cd2833e5f66b2ba1dca830e527c256 (patch)
tree3d37f704415151f68c7e67a3e6b955082b957ddd /llvm/lib/Transforms
parentb8bba6f7651da4ee068b33eaa924e55bf5268c11 (diff)
downloadbcm5719-llvm-5f00d66cc3cd2833e5f66b2ba1dca830e527c256.tar.gz
bcm5719-llvm-5f00d66cc3cd2833e5f66b2ba1dca830e527c256.zip
Factor silly code duplication out
llvm-svn: 3627
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/IPO/DeadTypeElimination.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/llvm/lib/Transforms/IPO/DeadTypeElimination.cpp b/llvm/lib/Transforms/IPO/DeadTypeElimination.cpp
index 842bc58b296..58fe7f0a595 100644
--- a/llvm/lib/Transforms/IPO/DeadTypeElimination.cpp
+++ b/llvm/lib/Transforms/IPO/DeadTypeElimination.cpp
@@ -74,7 +74,11 @@ bool DTE::run(Module &M) {
// 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
@@ -83,15 +87,6 @@ bool DTE::run(Module &M) {
#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;
} else {
++PI;
}
OpenPOWER on IntegriCloud