X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FTransforms%2FIPO%2FDeadTypeElimination.cpp;h=58fe7f0a595b7d7014285b8fd4013e9056460dc7;hb=eb53ae4f2dc39e75e725b21b52d77d29cf1c11c9;hp=842bc58b29656cf180b0ce4238e0abe5e951d1a6;hpb=5f0eb8da62308126d5b61e3eee5bee75b9dc5194;p=oota-llvm.git diff --git a/lib/Transforms/IPO/DeadTypeElimination.cpp b/lib/Transforms/IPO/DeadTypeElimination.cpp index 842bc58b296..58fe7f0a595 100644 --- a/lib/Transforms/IPO/DeadTypeElimination.cpp +++ b/lib/Transforms/IPO/DeadTypeElimination.cpp @@ -74,21 +74,16 @@ 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(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(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;