aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/IPO
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/IPO')
-rw-r--r--lib/Transforms/IPO/DeadTypeElimination.cpp49
-rw-r--r--lib/Transforms/IPO/FunctionResolution.cpp5
2 files changed, 26 insertions, 28 deletions
diff --git a/lib/Transforms/IPO/DeadTypeElimination.cpp b/lib/Transforms/IPO/DeadTypeElimination.cpp
index a1860a92e9..2ea9ac2a56 100644
--- a/lib/Transforms/IPO/DeadTypeElimination.cpp
+++ b/lib/Transforms/IPO/DeadTypeElimination.cpp
@@ -63,35 +63,34 @@ static inline bool ShouldNukeSymtabEntry(const std::pair<std::string,Value*>&E){
bool DTE::run(Module &M) {
bool Changed = false;
- if (SymbolTable *ST = M.getSymbolTable()) {
- const std::set<const Type *> &UsedTypes =
- getAnalysis<FindUsedTypes>().getTypes();
+ SymbolTable &ST = M.getSymbolTable();
+ const std::set<const Type *> &UsedTypes =
+ getAnalysis<FindUsedTypes>().getTypes();
- // 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.
- //
- if (ShouldNukeSymtabEntry(*PI) ||
- !UsedTypes.count(cast<Type>(PI->second))) {
+ // 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.
+ //
+ if (ShouldNukeSymtabEntry(*PI) ||
+ !UsedTypes.count(cast<Type>(PI->second))) {
#if MAP_IS_NOT_BRAINDEAD
- PI = Plane.erase(PI); // STD C++ Map should support this!
+ 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();
+ Plane.erase(PI); // Alas, GCC 2.95.3 doesn't *SIGH*
+ PI = Plane.begin();
#endif
- ++NumKilled;
- Changed = true;
- } else {
- ++PI;
- }
- }
+ ++NumKilled;
+ Changed = true;
+ } else {
+ ++PI;
+ }
}
return Changed;
diff --git a/lib/Transforms/IPO/FunctionResolution.cpp b/lib/Transforms/IPO/FunctionResolution.cpp
index cbcfa2aba8..bb3a9af659 100644
--- a/lib/Transforms/IPO/FunctionResolution.cpp
+++ b/lib/Transforms/IPO/FunctionResolution.cpp
@@ -304,8 +304,7 @@ static bool ProcessGlobalsWithSameName(Module &M,
}
bool FunctionResolvingPass::run(Module &M) {
- SymbolTable *ST = M.getSymbolTable();
- if (!ST) return false;
+ SymbolTable &ST = M.getSymbolTable();
std::map<string, vector<GlobalValue*> > Globals;
@@ -313,7 +312,7 @@ bool FunctionResolvingPass::run(Module &M) {
// then add it to the Functions map. We do a two pass algorithm here to avoid
// problems with iterators getting invalidated if we did a one pass scheme.
//
- for (SymbolTable::iterator I = ST->begin(), E = ST->end(); I != E; ++I)
+ for (SymbolTable::iterator I = ST.begin(), E = ST.end(); I != E; ++I)
if (const PointerType *PT = dyn_cast<PointerType>(I->first)) {
SymbolTable::VarMap &Plane = I->second;
for (SymbolTable::type_iterator PI = Plane.begin(), PE = Plane.end();